aIRC — File Browser

aIRCv0.8.69 / aIRCv0.8.69 / addons / sound5.mrc

sound5.mrc — 22.04 KB — Download this file

;/**********************************************************************
; *
; * aIRC
; * Sound System (soundsetup+equalizer)
; *
; **********************************************************************/
;

;;
;
; -( SoundSetup )-
;
;;
dialog _soundsetup {
  size -1 -1 230 138
  option dbu
  title "Sound Setup"

  tab "Main",1001,5 5 220 110
  tab "Plugins",1006
  tab "Player",1002
  tab "Server",1004
  tab "Ads",1003
  tab "Replies1",1005

  check "Listen for '!nick file' get requests",2301,10 30 100 8,tab 1001
  check "Accept sound requests",2303,10 42 100 8,tab 1001
  check "Ignore if a sound is currently playing",2304,10 54 100 8,tab 1001
  check "Warn if sound doesn't exist",2305,10 66 100 8,tab 1001
  check "Request a resume on get fail",2302,10 78 100 8,tab 1001
  check "Don't open query if it's a @find reply",2306,10 90 100 8,tab 1001
  text "(only if aIRCpster is open)",2307,10 98 94 8,tab 1001 right
  text "Directories:",100,115 21 40 10,tab 1001
  list 101,115 28 100 70,hsbar vsbar extsel size tab 1001
  ;;;  button "Search!",102,10 120 30 15,disable tab 1001
  button "Up",103,115 100 20 10,tab 1001
  button "Down",104,140 100 20 10,tab 1001
  button "Add",105,170 100 20 10,tab 1001
  button "Del",106,195 100 20 10,tab 1001

  box "Options",212,10 25 211 87,tab 1004
  box "Flood Prot",213,115 25 106 87,tab 1004
  check "Enable @find @locator",201,15 33 100 10,tab 1004
  text "Max matches:",202,20 47 70 10,tab 1004
  edit "",203,85 45 15 10,tab 1004 autohs
  check "Show requests in...",1401,15 60 70 10,tab 1004
  radio "Active Window",1402,25 70 55 10,tab 1004
  radio "Status Window",1403,25 80 55 10,tab 1004
  radio "@SoundServer Window",1404,25 90 70 10,tab 1004
  check "Trigger after",1301,120 35 70 8,tab 1004
  edit "",1302,130 45 15 10,tab 1004 autohs
  text "requests in...",1303,148 47 60 8,tab 1004
  edit "",1304,130 57 15 10,tab 1004 autohs
  text "seconds, ignore...",1305,148 59 60 8,tab 1004
  edit "",1306,130 69 15 10,tab 1004 autohs
  text "seconds",1307,148 71 60 8,tab 1004
  check "After a succesful @find, ignore",1308,120 85 100 10,tab 1004
  text "requests",1309,130 95 20 10,tab 1004
  edit "",1310,152 93 20 10,tab 1004
  text "seconds",1311,174 95 20 10,tab 1004

  edit "",250,999 999 100 100,hide

  box "",290,10 25 211 87,tab 1002

  check "Send CTCPs",210,15 33 50 10,tab 1002
  button "Sound Targets",211,165 33 50 10,tab 1002
  text "On remote play (offering)",302,15 50 60 8,tab 1002
  edit "",303,20 58 190 10,tab 1002 autohs
  button "!",313,211 58 7 10,tab 1002
  text "On remote play (not offering)",304,15 70 80 8,tab 1002
  edit "",305,20 78 190 10,tab 1002 autohs
  button "!",315,211 78 7 10,tab 1002
  text "On local play",306,15 90 60 8,tab 1002
  edit "",307,20 98 190 10,tab 1002 autohs
  button "!",317,211 98 7 10,tab 1002

  box "",2111,10 25 211 67,tab 1003
  check "/msg channels every",2112,15 33 65 8,tab 1003
  edit "",2113,80 31 15 10,tab 1003 autohs
  text "minutes",2114,98 33 18 8,tab 1003
  check "On Join msg",2115,120 33 45 8,tab 1003
  check "Send SLOTS ctcp",2120,165 33 55 8,tab 1003
  check "Only in these channels:",2116,15 46 63 8,tab 1003
  edit "",2117,80 44 135 10,tab 1003 autohs
  text "Message:",2118,15 58 180 8,tab 1003
  edit "",2119,15 66 195 10,tab 1003 autohs
  button "!",2129,211 66 7 10,tab 1003

  box "@find/@locator replies when there are matches found",2201,10 22 211 90,tab 1005
  text "First Line",2202,15 30 60 8,tab 1005
  edit "",2203,20 38 190 10,tab 1005 autohs
  button "!",2204,211 38 7 10,tab 1005
  text "File line",2205,15 50 60 8,tab 1005
  edit "",2206,20 58 190 10,tab 1005 autohs
  button "!",2207,211 58 7 10,tab 1005
  text "Last Line (normal)",2208,15 70 80 8,tab 1005
  edit "",2209,20 78 190 10,tab 1005 autohs
  button "!",2210,211 78 7 10,tab 1005
  text "Last Line (too many matches)",2211,15 90 80 8,tab 1005
  edit "",2212,20 98 190 10,tab 1005 autohs
  button "!",2213,211 98 7 10,tab 1005

  box "Winamp Plugins Settings",2401,10 22 211 90,tab 1006
  text "Winamp Plugins Directory:",2402,15 35 65 8,tab 1006
  edit "",2403,85 33 115 10,tab 1006 autohs
  button "...",2404,205 33 12 10,tab 1006
  text "",2405,15 50 200 10,tab 1006
  text "",2406,15 65 200 40,tab 1006


  text "Text Presets:",2982,10 125 33 10
  combo 2983,45 123 90 50,drop
  combo 2984,45 123 90 50,drop hide
  button "save",2985,137 123 20 10

  button "&Ok",2992,160 120 30 15,ok
  button "&Cancel",2993,195 120 30 15,cancel
}
ON *:DIALOG:_soundsetup:init:0:{
  _mdx.init $_icofile(mp3.ico,$scriptdir)
  var %d = $dname
  _sound.d.initpresets
  did $iif($_getsetup(mp3,sendfileson!nickfile),-c,-u) %d 2301
  did $iif($_getsetup(mp3,resumeongetfail),-c,-u) %d 2302
  did $iif($_getsetup(mp3,remotesreqs.status),-c,-u) %d 2303
  did $iif($_getsetup(mp3,remotesreqs.ignoreifplaying),-c,-u) %d 2304
  did $iif($_getsetup(mp3,remotesreqs.warnifnofile),-c,-u) %d 2305
  did $iif($_getsetup(mp3,aIRCpster.no@findquery),-c,-u) %d 2306

  var %plugindir = $_fixdir($_getsetup(mp3,winampplugindir))
  if ($_sound.iswinampplugindir(%plugindir)) { did -o %d 2403 1 %plugindir }

  did -o %d 2406 1 If you want to listen your MP3s in the script, you must set your winamp directory. The script will use winamp's "in_mp3.dll" and "out_wave.dll" to play your MP3 files. If you don't set the plugin dir, mIRC's internal MP3 system will be used. It's slower, more CPU intensive, the script may get laggy, and you won't be able to set the sound balance or use the equalizer, so I *really* recommend you to use the winamp plugins.

  _dialog.loadlist %d 101 1- 32 mp3dirs 0 1
  did $iif($_getsetup(mp3,@find@locator),-c,-u) %d 201
  if ($_isint($_getsetup(mp3,@maxmatches))) { did -o %d 203 1 $ifmatch }
  else { did -o %d 203 1 6 }
  did $iif($_getsetup(mp3,@floodprot.state),-c,-u) %d 1301
  if ($_isint($_getsetup(mp3,@floodprot.reqs))) { did -o %d 1302 1 $ifmatch }
  else { did -o %d 1302 1 4 }
  if ($_isint($_getsetup(mp3,@floodprot.secs))) { did -o %d 1304 1 $ifmatch }
  else { did -o %d 1304 1 10 }
  if ($_isint($_getsetup(mp3,@floodprot.ignt))) { did -o %d 1306 1 $ifmatch }
  else { did -o %d 1306 1 20 }
  did $iif($_getsetup(mp3,@secondsprot.state),-c,-u) %d 1308
  if ($_isint($_getsetup(mp3,@secondsprot.secs))) { did -o %d 1310 1 $ifmatch }
  else { did -o %d 1310 1 8 }
  did $iif($_getsetup(mp3,dontsendctcp),-u,-c) %d 210
  if ($_getsetup(mp3,format.remote.o) != $null) { did -o %d 303 1 $ifmatch }
  if ($_getsetup(mp3,format.remote.n) != $null) { did -o %d 305 1 $ifmatch }
  if ($_getsetup(mp3,format.local) != $null) { did -o %d 307 1 $ifmatch }

  did $iif($_getsetup(mp3,advertimerstatus),-c,-u) %d 2112
  if ($_isint($_getsetup(mp3,advertimertime))) { did -o %d 2113 1 $ifmatch }
  did $iif($_getsetup(mp3,advertonjoin),-c,-u) %d 2115
  did $iif($_not($_getsetup(mp3,advertall)),-c,-u) %d 2116
  did -o %d 2117 1 $_fixchans($_getsetup(mp3,advertchannels))
  did -o %d 2119 1 $_getsetup(mp3,admsg)
  did $iif($_getsetup(mp3,sendslotsctcp),-c,-u) %d 2120

  did $iif($_getsetup(mp3,@echo),-c,-u) %d 1401
  did -c %d $calc($_getsetup(mp3,@echowin) + 1402)

  if ($_getsetup(mp3,format.find.first) != $null) { did -o %d 2203 1 $ifmatch }
  if ($_getsetup(mp3,format.find.filel) != $null) { did -o %d 2206 1 $ifmatch }
  if ($_getsetup(mp3,format.find.lastn) != $null) { did -o %d 2209 1 $ifmatch }
  if ($_getsetup(mp3,format.find.lastm) != $null) { did -o %d 2212 1 $ifmatch }

  _dummy $_lang.loaddialog($dname,$dname,00086969,sound.lang,$scriptdir)

  did -m %d 2403
  did -z %d 101
}
alias _sound.@prot {
  if (%__soundno@find@locator.1) { return 1 }
  if ($1) {
    if (%__soundno@find@locator.2) { return 1 }
    if ($_getsetup(mp3,@secondsprot.state)) && ($_isint($_getsetup(mp3,@secondsprot.secs)) > 0) {
      set -u [ $+ [ $ifmatch ] ] %__soundno@find@locator.2 1
      return 1
    }
  }
  var %state = $_getsetup(mp3,@floodprot.state),%reqs = $round($_getsetup(mp3,@floodprot.reqs),0),%secs = $round($_getsetup(mp3,@floodprot.secs),0),%ignt = $round($_getsetup(mp3,@floodprot.ignt),0)
  if (%state) && (%reqs) && (%secs) && (%ignt) && ($_flood.main(1,0,%reqs,0,%secs,__soundnocount@find@locator,l)) {
    set -u [ $+ [ %ignt ] ] %__soundno@find@locator.1 1
    return 1
  }
  return 0
}
alias _sound.echo {
  if ($_getsetup(mp3,@echo)) {
    var %twin = $_getsetup(mp3,@echowin),%win = @SoundServer,%line = [mp3] $1-
    if (%twin == 2) && ($_not($window(%win))) {
      window -nk %win $_window.conf(%win)
      _window.font.reset %win %win
      if ($_fixfilename($_logdir(@SoundServer.log),em) != $null) { loadbuf -c $+ $colour(info) %win $"($ifmatch) }
      timestamp on %win
    }
    if ($window(%win)) { echo $colour(info) -i %win $timestamp $^*** $1- }
    elseif (%twin) { info.s %line }
    else { info.a %line }
  }
}
ON *:DIALOG:_soundsetup:sclick:103:{
  did -o $dname 250 1 1
  _dialog.up $dname 101 101
}
ON *:DIALOG:_soundsetup:sclick:104:{
  did -o $dname 250 1 1
  _dialog.down $dname 101 101
}
ON *:DIALOG:_soundsetup:sclick:105:{
  did -o $dname 250 1 1
  .timer -o 1 0 _soundsetup.askdir
}
ON *:DIALOG:_soundsetup:sclick:106:{
  did -o $dname 250 1 1
  var %l = $did($dname,101,1).sel
  _dialog.delsels $dname 101
  if (%l <= $did($dname,101).lines) { did -c $dname 101 %l }
  else { did -c $dname 101 $did($dname,101).lines }
  did -z $dname 101
}
ON *:DIALOG:_soundsetup:sclick:211:{ soundtargets }
ON *:DIALOG:_soundsetup:sclick:313,315,317,2129:{ _txtpreviewin $dialog($dname).x 1 $dialog($dname).w 80 $dname $calc($did - 10) $calc($did - 10) - _sound.winprev }
ON *:DIALOG:_soundsetup:sclick:2204,2207,2210,2213:{ _txtpreviewin $dialog($dname).x 1 $dialog($dname).w 80 $dname $calc($did - 1) $calc($did - 1) - _sound.winprev }
ON *:DIALOG:_soundsetup:sclick:2404:{
  var %basedir = $did($dname,2403,1)
  if ($isdir(%basedir) == $false) { %basedir = $left($mircdir,3) }
  var %dir1 = $$sdir="Select the Winamp Plugin Directory:" %basedir,%dir1 = $_fixdir(%dir1),%dir2 = %dir1 $+ plugins\
  if ($_sound.iswinampplugindir(%dir1)) { did -o $dname 2403 1 %dir1 }
  elseif ($_sound.iswinampplugindir(%dir2)) { did -o $dname 2403 1 %dir2 }
  else {
    did -o $dname 2405 1 Invalid Winamp Plugins directory!
    return
  }
  did -r $dname 2405
}
ON *:DIALOG:_soundsetup:sclick:2983:{ _sound.d.txtpreset $did($dname,2984,$did($dname,2983).sel) }
ON *:DIALOG:_soundsetup:sclick:2985:{
  _addontextscheme.save $dname Sound sts 303,format.remote.o,+ 305,format.remote.n,+ 307,format.local,+ 2119,admsg,+ 2203,format.find.first,+ 2206,format.find.filel,+ 2209,format.find.lastn,+ 2212,format.find.lastm,+
  if ($result != $null) { _sound.d.initpresets $ifmatch }
}
alias -l _sound.d.initpresets {
  var %d = _soundsetup
  if ($dialog(%d) == $null) { return }
  did -r %d 2983,2984
  did -o %d 2983,2984 1 Default
  _dummy $findfile($mircdiraddons\tschemes\,*.sts,0,1,_sound.d._initpresets $1-)
  if ($didwm(%d,2984,$1,1)) { did -c %d 2983 $ifmatch }
}
alias -l _sound.d._initpresets {
  var %d = _soundsetup,%file = " $+ $1- $+ ",%name = $read -nsschemename %file ,%author = $read -nsauthor %file
  if (%name != $null) {
    if (%author != $null) { did -a %d 2983 %name ( $+ %author $+ ) }
    else { did -a %d 2983 %name }
    did -a %d 2984 $nopath(%file)
  }
}
alias -l _sound.d.txtpreset {
  var %d = _soundsetup,%preset = $1-,%topics,%dids,%i,%cdid,%read,%zt,%file,%evangelion
  if ($dialog(%d) == $null) { return 1 }
  %file = " $+ addons\tschemes\ $+ $1- $+ "
  if ($1- == default) || ($isfile(%file) == $false) { var %file }
  %topics = format.remote.o format.remote.n format.local admsg format.find.first format.find.filel format.find.lastn format.find.lastm
  %dids = 303 305 307 2119 2203 2206 2209 2212
  did -r %d $replace(%dids,$chr(32),$chr(44))
  %i = $numtok(%dids,32)
  while (%i) {
    var %evangelion,%cdid = $gettok(%dids,%i,32),%zt = $gettok(%topics,%i,32)
    if (%file) { %evangelion = $read -ns $+ %zt %file }
    if ($1- == default) || ((%evangelion == $null) && ($istok(303 305 307 2119 2206,%cdid,32))) { %evangelion = $_sound.txtpreset.default(%zt) }
    did -o %d %cdid 1 %evangelion
    dec %i
  }
}
alias -l _sound.txtpreset.default {
  if ($istok(format.remote.o format.remote.n format.local admsg format.find.first format.find.filel format.find.lastn format.find.lastm,$1,32) == $false) { return }
  goto $1
  :format.remote.o   | return [<ARTIST>] <TITLE> -(<$_:duration(<DURATION>)>/<KBPS>kbps/<KHZ>kHz/<STEREO>/<$_size(<FILESIZE>)>)- - Type "<TRIGGER>" to get it (aIRC)
  :format.remote.n   | return [<ARTIST>] <TITLE> -(<$_:duration(<DURATION>)>/<KBPS>kbps/<KHZ>kHz/<STEREO>/<$_size(<FILESIZE>)>)- (aIRC)
  :format.local      | return Playing: [<ARTIST>] <TITLE> -(<$_:duration(<DURATION>)>/<KBPS>kbps/<KHZ>kHz/<STEREO>/<$_size(<FILESIZE>)>)-
  :admsg             | return Offering <MP3FILESNUM> MP3s - Type @<ME> to get my list - [min speed: <$_size($calc(<SEND_MINSPEED> * 1024))>/s] slots[<SENDS_CURR>/<SENDS_MAX>] ques[<QUEUE_CURR>/<QUEUE_MAX>] [next send: <NEXTSEND>] [cps in use: <CURRENT_CPS>] record[<$_size(<RECORDCPS>)>/s by <RECORDBY>] served[<SERVEDFILES> files/<$_size(<SERVEDBYTES>)>] (aIRC)
  :format.find.first | return Found <$_nsingoplur(<MATCH_FOUND>,match,matches)> for '<MATCH_STRING>' - Copy and paste a line in <CHAN> to request a file - slots[<SENDS_CURR>/<SENDS_MAX>] ques[<QUEUE_CURR>/<QUEUE_MAX>]
  :format.find.filel | return <TRIGGER>
  :format.find.lastn | return End of list - <$_nsingoplur(<MATCH_FOUND>,match,matches)> found - Use @<ME> to get my list: '<MP3INDEXFILE>' [<$_size(<MP3INDEXSIZE>)>]
  :format.find.lastm | return There are <MATCH_MORE> more files matching '<MATCH_STRING>' - Use @<ME> to get my list: '<MP3INDEXFILE>' [<$_size(<MP3INDEXSIZE>)>]
}
alias _sound.winprev {
  var %f = Geinoh Yamashirogumi - Akira - 01 - Kaneda.mp3,%pf = C:\mp3\ $+ %f,%trigger = ! $+ $me %f,%tmp = $replace($1-,<KBPS>,<BITRATE>,<HZ>,<SAMPLE>,<STEREO>,<MODE>,<SIZE>,<FILESIZE>)
  var %indexfile = $_sound.indexfile,%indexsize = 0
  if ($isfile(%indexfile)) { %indexsize = $file(%indexfile).size }
  else { var %indexfile = mp3list.htm,%indexsize = $rand(350000,550000) }
  %indexfile = $nopath(%indexfile)
  %tmp = $replace(%tmp,<ALBUM>,Akira Soundtrack,<TITLE>,Kaneda,<ARTIST>,Geinoh Yamashirogumi,<YEAR>,2001,<COMMENT>,Great Song,<GENRE>,Anime,<TRACK>,01,<LENGTH>,190730,<VERSION>,MPEG 1.0 Layer 3,<BITRATE>,128,<VARIABLE>,$false,<SAMPLE>,44100,<MODE>,Joint Stereo,<COPYRIGHT>,$true,<PRIVATE>,$false,<CRC>,$false,<KHZ>,44.1,<FILESIZE>,2288768,<FILE>,%f,<PATHFILE>,%pf,<DURATION>,191,<TRIGGER>,%trigger)
  %tmp = $replace(%tmp,<MP3FILESNUM>,$_mp3.files.total(*.mp?,-),<SERVEDFILES>,$_sound.servedfiles,<SERVEDBYTES>,$_sound.servedbytes,<RECORDCPS>,$_sound.getrecordcps,<RECORDBY>,$_sound.getrecordby,<CHAN>,$iif($chan(1),$chan(1),#channel),<MATCH_FOUND>,10,<MATCH_STRING>,akira,<MATCH_CURR>,1,<MATCH_MORE>,4,<MP3INDEXSIZE>,%indexsize,<MP3INDEXFILE>,%indexfile)
  return $_evaltext(%tmp)
}
ON *:DIALOG:_soundsetup:sclick:2992:{
  var %d = $dname

  _setsetup mp3 sendfileson!nickfile $did(%d,2301).state
  _setsetup mp3 resumeongetfail $did(%d,2302).state
  _setsetup mp3 remotesreqs.status $did(%d,2303).state
  _setsetup mp3 remotesreqs.ignoreifplaying $did(%d,2304).state
  _setsetup mp3 remotesreqs.warnifnofile $did(%d,2305).state
  _setsetup mp3 aIRCpster.no@findquery $did(%d,2306).state

  if ($did(%d,250,1)) { _dialog.savelist %d 101 mp3dirs 0 }
  _setsetup mp3 @find@locator $did(%d,201).state
  if ($_isint($did(%d,203,1)) >= 1) { _setsetup mp3 @maxmatches $ifmatch }
  else { _setsetup mp3 @maxmatches 6 }
  _setsetup mp3 @floodprot.state $did(%d,1301).state
  if ($_isint($did(%d,1302,1)) >= 1) { _setsetup mp3 @floodprot.reqs $ifmatch }
  else { _setsetup mp3 @floodprot.reqs 4 }
  if ($_isint($did(%d,1304,1)) >= 1) { _setsetup mp3 @floodprot.secs $ifmatch }
  else { _setsetup mp3 @floodprot.secs 10 }
  if ($_isint($did(%d,1306,1)) >= 1) { _setsetup mp3 @floodprot.ignt $ifmatch }
  else { _setsetup mp3 @floodprot.ignt 20 }
  if ($_isint($did(%d,1310,1)) >= 1) { _setsetup mp3 @secondsprot.secs $ifmatch }
  else { _setsetup mp3 @secondsprot.secs 3 }
  _setsetup mp3 @secondsprot.state $did(%d,1308).state

  if ($did(%d,303) != $null) { _setsetup mp3 format.remote.o $ifmatch }
  if ($did(%d,305) != $null) { _setsetup mp3 format.remote.n $ifmatch }
  if ($did(%d,307) != $null) { _setsetup mp3 format.local $ifmatch }

  _setsetup mp3 advertimerstatus $did(%d,2112).state
  if ($_isint($did(%d,2113,1)) >= 1) { _setsetup mp3 advertimertime $ifmatch }
  else { _setsetup mp3 advertimertime 8 }
  _setsetup mp3 advertonjoin $did(%d,2115).state
  _setsetup mp3 advertall $_not($did(%d,2116).state)
  _setsetup mp3 advertchannels $_fixchans($did(%d,2117,1))
  _setsetup mp3 admsg $did(%d,2119,1)
  _setsetup mp3 sendslotsctcp $did(%d,2120).state

  _setsetup mp3 @echo $did(%d,1401).state
  if ($did(%d,1402).state) { _setsetup mp3 @echowin 0 }
  elseif ($did(%d,1403).state) { _setsetup mp3 @echowin 1 }
  else { _setsetup mp3 @echowin 2 }

  _setsetup mp3 format.find.first $did(%d,2203)
  _setsetup mp3 format.find.filel $did(%d,2206)
  _setsetup mp3 format.find.lastn $did(%d,2209)
  _setsetup mp3 format.find.lastm $did(%d,2212)

  _setsetup mp3 winampplugindir $did(%d,2403)

  _setsetup mp3 dontsendctcp $_not($did(%d,210).state)
  _sound.loadsetup
}
alias _sound.loadsetup {
  $iif($_getsetup(mp3,aIRCpster.no@findquery),.enable,.disable) #_soundno@findquery
  if ($_getsetup(mp3,sendfileson!nickfile)) {
    .enable #_soundoffering
    _sound.ad.allchans
  }
  else { .disable #_soundoffering }
  if ($_not($_sound.aretherequiredwinampdllsloadedtoplaymymetallicamp3s?)) {
    if ($_not($_sound.iswinampplugindir($_getsetup(mp3,winampplugindir)))) {
      var %dir,%i = 1,%pd = C:\winamp\plugins\"C:\program files\winamp\plugins\"C:\archivos de programa\winamp\plugins\
      while ($gettok(%pd,%i,34) != $null) {
        %dir = $ifmatch
        if ($_sound.iswinampplugindir(%dir)) {
          _setsetup mp3 winampplugindir %dir
          break
        }
        inc %i
      }
    }
    var %dir = $_fixdir($_getsetup(mp3,winampplugindir))
    if ($_sound.iswinampplugindir(%dir)) {
      _ampdll.FlushAllPlugins
      _ampdll.PluginLoad output %dir $+ out_wave.dll
      _ampdll.PluginLoad input %dir $+ in_mp3.dll
    }
    else { _setsetup mp3 winampplugindir }
  }
}
alias _sound.iswinampplugindir {
  if ($1- == $null) || ($isdir($1-) == $false) { return 0 }
  var %dir = $1-
  if (*\ !iswm %dir) { %dir = %dir $+ \ }
  var %f1 = %dir $+ in_mp3.dll,%f2 = %dir $+ out_wave.dll
  if ($isfile(%f1)) && ($isfile(%f2)) { return 1 }
  return 0
}
;;
;
; -( Equalizer )-
;
;;
alias equalizer {
  if ($dialog(_aircamp)) {
    dialog -v _aircamp
    _dialog -am _equalizer _equalizer
  }
  else { _dialog -m _equalizer _equalizer }
}

dialog _equalizer {
  size -1 -1 185 70
  option dbu
  title "aIRCamp Equalizer"

  check "&On",1001,2 2 20 8
  check "&Auto",1002,30 2 30 8,disable
  button "&Default",1003,153 2 30 8,disable

  list 1101,3 13 16 50,size
  text "Preamp",1102,3 63 16 8,center

  text "+20db",1103,18 14 13 8,right
  text "+0db",1104,18 35 13 8,right
  text "-20db",1105,18 56 13 8,right

  list 1501,35 13 15 50,size
  text "60",1502,35 63 15 8,center

  list 1511,50 13 15 50,size
  text "170",1512,50 63 15 8,center

  list 1521,65 13 15 50,size
  text "310",1522,65 63 15 8,center

  list 1531,80 13 15 50,size
  text "600",1532,80 63 15 8,center

  list 1541,95 13 15 50,size
  text "1k",1542,95 63 15 8,center

  list 1551,110 13 15 50,size
  text "3k",1552,110 63 15 8,center

  list 1561,125 13 15 50,size
  text "6k",1562,125 63 15 8,center

  list 1571,140 13 15 50,size
  text "12k",1572,140 63 15 8,center

  list 1581,155 13 15 50,size
  text "14k",1582,155 63 15 8,center

  list 1591,170 13 15 50,size
  text "16k",1592,170 63 15 8,center

  button "cancel",2990,-100 -100 1 1,cancel
}
ON *:DIALOG:_equalizer:init:0:{
  _mdx.init $_icofile(aircamp.ico,$_addonsdir)
  _mdx.SetControlMDX bars.mdx $dname 1101 TrackBar vertical both
  did -i $dname 1101 1 params $_ampdll.EQpreampget 0 63 1 10 * * 10
  did -i $dname 1101 1 ticfreq 32
  _mdx.SetBorderStyle $dname 1101
  var %tmp = $_ampdll.EQget
  if (OK * iswm %tmp) {
    var %i = 1,%did,%tmp = $deltok(%tmp,1,32)
    while (%i <= 10) {
      %did = $calc(1491 + 10 * %i)
      _mdx.SetControlMDX bars.mdx $dname %did TrackBar vertical both
      did -i $dname %did 1 params $gettok(%tmp,%i,32) 0 63 1 10 * * 10
      did -i $dname %did 1 ticfreq 32
      _mdx.SetBorderStyle $dname %did
      inc %i
    }
  }
  did $iif($_ampdll.EQstatus,-c,-u) $dname 1001
  _mdx.SetFont $dname 1001,1002,1003 + 13 400 Tahoma
  _mdx.SetFont $dname 1102,1103,1104,1105,1502,1512,1522,1532,1542,1552,1562,1572,1582,1592 + 11 400 Tahoma
  _equalizer.enabledisable
}
ON *:DIALOG:_equalizer:sclick:1001:{
  $iif($did($dname,$did).state,_ampdll.EQon,_ampdll.EQoff)
  _equalizer.enabledisable
}
ON *:DIALOG:_equalizer:sclick:1003:{
  _ampdll.EQpreampset 31
  did -i $dname 1101 1 params 31
  _ampdll.EQset 31 31 31 31 31 31 31 31 31 31
  var %i = 1501
  while (%i <= 1591) {
    did -i $dname %i 1 params 31
    inc %i 10
  }
}
ON *:DIALOG:_equalizer:sclick:1501,1511,1521,1531,1541,1551,1561,1571,1581,1591:{
  if ($gettok($did($dname,$did,1),9,32) == end) {
    var %tmp = $gettok($did($dname,1501,1),1,32) $gettok($did($dname,1511,1),1,32) $gettok($did($dname,1521,1),1,32) $gettok($did($dname,1531,1),1,32) $gettok($did($dname,1541,1),1,32) $gettok($did($dname,1551,1),1,32) $gettok($did($dname,1561,1),1,32) $gettok($did($dname,1571,1),1,32) $gettok($did($dname,1581,1),1,32) $gettok($did($dname,1591,1),1,32)
    _ampdll.EQset %tmp
  }
}
ON *:DIALOG:_equalizer:sclick:1101:{
  var %tmp = $did($dname,1101,1)
  if ($gettok(%tmp,9,32) == end) { _ampdll.EQpreampset $gettok(%tmp,1,32) }
}
alias -l _equalizer.enabledisable { did $iif($did($dname,1001).state,-e,-b) $dname 1003,1101,1102,1103,1104,1105,1501,1502,1511,1512,1521,1522,1531,1532,1541,1542,1551,1552,1561,1562,1571,1572,1581,1582,1591,1592 }