Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Backticks and other tricks



Hi.

Can anyone cast some light on the following questions
regarding the code below:
1. Why does ${(P)...[...]} not work with subscripts of the
array? (in fucntion argsargs).
2. Why does the inclusion trick with backticks not
work (`argsargs filters`). Actually _arguments complains
about not being able to parse this option. 



#compdef ecasound

typeset -A filters
filters=(\
ef1 "Resonant bandpass filter":"center frequency":Hz:"width":Hz
ef3 "Resonant lowpass filter":"cutoff frequency":Hz:resonance::gain:
ef4 "Resonant lowpass filter (3rd-order, 36dB)":"cutoff frequency":Hz:resonance:
efa "Allpass filter":"delay":samples:"feedback":percents
efb "Bandpass filter":"center frequency":Hz:"width":Hz
efc "Comb filter":"delay":samples:"radius":0-1
efh "Highpass filter":"cutoff frequency":Hz
efi "Inverse comb filter":"delay":samples:"radius":0-1
efl "Lowpass filter":"cutoff frequency":Hz
efr "Bandreject filter":"center frequency":Hz:"width":Hz
efs "Resonator (resonating bandpass filter)":"center frequency":Hz:"width":Hz\
)

argsargs () {
  for i in ${(koP)1}; do
    print -- "'*-${i}[${(P)1[$i]%%:*}]: :->${i}' \\"
  done
}

_arguments \
  '-c[Start in interactive mode]' \
  '-d\:-[Debug level]:debug level' \
  '-D[Print all debug information to stderr]' \
  '-q[Quiet mode, no output]' \
  '--help[Show help]' \
  '--version[Show version information]' \
  '-n\:-[Set the name of chainsetup]:chainsetup name' \
  '-s\:-[Create a new chainsetup from file]:chainsetup file:_files' \
  '-sr\:-[Set internal sampling rate]:Internal sampling rate:(8000 11025 22050 44100 48000)' \
  '*-a\:-[Select active signal chains]:chain name' \
  '-b\:-[Sets the size of buffer in samples]:buffer size:(1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536)' \
  '-m\:-[Force use of specified mix mode]:Mix mode:((auto\:Automatic simple\:Only\ one\ input/cain/output normal\:Normal\ single-threaded\ mode))' \
  '-r[Use realtime scheduling policy (SCHED_FIFO)]' \
  '-r\:-[Use realtime scheduling policy (SCHED_FIFO)]:sched_priority' \
  '-x[Truncate outputs]' \
  '*-z\:-[Enable feature]:feature:->z' \
  '-t\:-[Set processing time in seconds]:seconds (int/float)' \
  '-tl[Enable looping]' \
  '*-f\:-[Set sampling parameters for the following input/output files]: :->f' \
  '*-y\:-[Set starting position for last specified input/output]:seconds' \
  '*-i\:-[Specifies a new input source]:input source:->io' \
  '*-o\:-[Specifies a new output source]:output source:->io' \
  '*-Md\:-[Set the active MIDI-device]:device name:_files' \
  '*-Mms\:-[Send MMC start/stop to MIDI device-id]:device id' \
  '*-mss[Sends MIDI-sync to the selected MIDI-device]' \
  '*-pf\:-[Use the first preset found from file as chain operator]:preset file:_files -g *.epp' \
  '*-pn\:-[Find preset from global preset database]:preset name:->pn' \
  '*-ev[Analyze sample data to find max apm value without clipping]' \
  '*-ezf[Find the optimal value for DC-adjusting]' \
  '*-eS\:-[Audio stamp]:stamp-id (int)' \
  '*-ea\:-[Amplify signal]:amplification value (percent)' \
  '*-eac\:-[Amplify signal of channel]: :->eac' \
  '*-eaw\:-[Amplify singal (clipping)]: :->eaw' \
  '*-eal\:-[Limits audio level]:limit (percent)' \
  '*-ec\:-[Compressor (a simple one)]: :->ec' \
  '*-eca\:-[A more advanced compressor]: :->eca' \
  '*-enm\:-[Noise gate. (each channel is processes separately)]: :-enm' \
  '*-ei\:-[Pitch shifter (modifies audio pitch by altering its length)]:pitch-shift (percent)' \
  '*-epp\:-[Normal pan effect]:panning (0=left, 50=center, 100=right)' \
  '*-ezx\:-[Adjusts the signal DC (use -ezf to find optimal values)]: :-ezx' \
  '*-eemb\:-[Pulse gate]: :-eemb' \
  '*-eemp\:-[Pulse gate (hz)]: :->eemp' \
  '*-eemt\:-[Tremolo effect]: :->eemt' \
  `argsargs filters` \
  '*-erc\:-[Copy channel]: :->erc' \
  '*-erm\:-[Mix all channels to one channel]:to channel' \
  '*-etc\:-[Chorus]: :->etc' \
  '*-etd\:-[Delay effect]: :->etd' \
  '*-ete\:-[A more advanced reverb effect]: :-ete' \
  '*-etf\:-[Fake-stereo effect]:delay time (msec)' \
  '*-etl\:-[Flanger]: :->etl' \
  '*-etm\:-[Multitap delay]: :->etm' \
  '*-etp\:-[Phaser]: :->etp' \
  '*-etr\:-[Reverb effect]: :->etr' \
  '*-el\:-[LADSPA Plugin]: :->el' \
  '*-eli\:-[LADSPA Plugin]: :->el' \
  '*-gc\:-[Time crop gate]: :->gc' \
  '*-ge\:-[Threshold gate]: :->ge' \
  && return 0
...

-- 
CYa,
   Mario <mlang@xxxxxxxxxxx>
Homepage(s): http://delysid.org | http://piss.at/

"Who is General Failure and why is he reading my hard disk ?"
Microsoft spel chekar vor sail, worgs grate !!
(By leitner@xxxxxxxxxxxxxxxx, Felix von Leitner)



Messages sorted by: Reverse Date, Date, Thread, Author