about summary refs log tree commit diff
path: root/Completion/Unix/Command/_ecasound
blob: cb6b724a0ad8e63800391e8495a65814854bd67d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
#compdef ecasound

local curcontext="$curcontext" state line expl
typeset -A opt_args

_arguments \
  '-c[start in interactive mode]' \
  '(-q)-d\:-[debug level]:debug level' \
  '-D[print all debug information to stderr]' \
  '(-d)-q[quiet mode, no output]' \
  '(-)--help[show usage information]' \
  '(-)--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\:-[set the size of buffer in samples]:buffer size:->b' \
  '-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' \
  '*-eem-[envelope modulation]: :->emod' \
  '*-ef-[apply filter effects]: :->filters' \
  '*-erc\:-[copy channel]: :->erc' \
  '*-erm\:-[mix all channels to one channel]:to channel' \
  '*-et-[time based effects]: :->teffects' \
  '*-el\:-[LADSPA Plugin]: :->el' \
  '*-eli\:-[LADSPA Plugin]: :->el' \
  '*-gc\:-[time crop gate]: :->gc' \
  '*-ge\:-[threshold gate]: :->ge' \
  && return 0

case $state in
  filters)
    _values -S : 'filter effect' \
      '1[resonant bandpass filter]: :->ef1' \
      '3[resonant lowpass filter]: :->ef3' \
      '4[resonant lowpass filter (3rd-order, 36dB)]: :->ef4' \
      'a[allpass filter]: :->efa' \
      'c[comb filter]: :->efc' \
      'b[bandpass filter]: :->efb' \
      'h[highpass filter]:cutoff frequency' \
      'i[inverse comb filter]: :->efi' \
      'l[lowpass filter]:cutoff frequency' \
      'r[bandreject filter]: :->efr' \
      's[resonator (resonating bandpass filter)]: :->efs'
  ;;
  teffects)
    _values -S : 'time based effect' \
      'c[chorus]: :->etc' \
      'd[delay effect]: :->etd' \
      'e[a more advanced reverb effect]: :->ete' \
      'f[fake-stereo effect]:delay time (msec)' \
      'l[flanger]: :->etl' \
      'm[multitap delay]: :->etm' \
      'p[phaser]: :->etp' \
      'r[reverb effect]: :->etr'
  ;;
  emod)
    _values -S : 'envelopme modulation' \
      'b[pulse gate]: :->eemb' \
      'p[pulse gate (hz)]: :->eemp' \
      't[tremolo effect]: :->eemt'
  ;;
esac

case $state in
  b)
    _wanted -V sizes expl 'buffer size' compadd \
        1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536
  ;;
  f)
    if compset -P '*,*,*,'; then
      _values 'interleaving' \
        'i[interleaved stream format]' \
	'n[noninterleaved]'
    elif compset -P '*,*,'; then
      _message 'sampling rate'
    elif compset -P '*,'; then
      _message 'channels'
    else
      _values 'sampling parameters' \
        'u8[unsigned 8-bit]' \
	's16_le[signed 16-bit little endian]' \
	's16_be[signed 16-bit big endian]' \
	's24_le[signed 24-bit little endian]' \
	's24_be[signed 24-bit big endian]' \
	's32_le[signed 32-bit little endian]' \
	's32_be[signed 32-bit big endian]' \
	'f32_le[32-bit float (little endian)]' \
	'f32_be[32-bit float (big endian)]'
    fi
  ;;
  z)
    _values -s , feature \
      '(nodb)db[enable double-buffering]' \
      '(db)nodb[disable double-buffering]' \
      'dbsize[set db buffer size]:buffer size in sample frames:(0 1 2 4 8 16)' \
      '(nointbuf)intbuf[use extra internal buffering for realtime devices]' \
      '(intbuf)nointbuf[prevent extra internal buffering for realtime devices]' \
      'xruns[processing will be halted when a under/overrun occurs]' \
      'psr[enable the precise-sample-rates]'
  ;;
  io)
    if compset -P 'alsa,'; then
      if [[ -e /proc/asound ]]; then
	eval `grep "^[[:digit:]]" < /proc/asound/cards|awk 'BEGIN {print "_values '\''ALSA device'\''" }; {print "'\''" $1 "[" $6, $7, $8, $9 "]'\''"}'||echo _message Wrong`
      else
	_message 'ALSA information bot found in proc filesystem'
      fi
    else
      _alternative \
        'files:input/output file:_files -g "*.(aif|aiff|mid|wav|ewf|mp3|mp2)"' \
        'streams:stream:(stdin stdout)' \
	'devices:realtime device:((/dev/dsp alsa\:alsa\ device null\:null\ device))'
    fi
  ;;
  pn)
    _wanted presets expl preset compadd \
        ${${(M)${(f)"$(</usr/share/ecasound/effect_presets)"}:#[a-z]*}%% *}
  ;;
  etd)
    if compset -P 3 '*,'; then
      _message 'mix (wet) (percent)'
    elif compset -P 2 '*,'; then
      _message 'number of delays'
    elif compset -P '*,'; then
      _values -s , 'surround mode' \
              '0[normal]' \
              '1[surround]' \
              '2[stereo-spread]'
    else
      _message 'delay time (msec)'
    fi
  ;;
  ge)
    if compset -P 2 '*,'; then
      _values 'volume mode'
              'rms'
    elif compset -P '*,'; then
      _message 'close threshold (percent)'
    else
      _message 'open threshold (percent)'
    fi
  ;;
  *)
    # all the rest are comma separated lists for which we use a message prompt
    typeset -A msgs
    local str
    msgs=(
      eac  'amplification value (percent):channel'								     				  
      eaw  'amplification value (percent):channel:max-clipped-samples'						     				  
      ec   'compression rate (decibels):threshold (0.0-1.0)'							     				  
      eca  'peak-level:release-time (seconds):fast compression rate (0.0-1.0):compression rate'		     				  
      enm  'threshold-level:pre-hold-time (msec):attack-time (msec):post-hold-time (msec):release-time (msec)'     				  
      ezx  'left DC fix value:right CD fix value'								     				  
      eemb 'pulse frequency (beats per minute):on time (msec)'
      eemp 'pulse frequency (hz):on time (percent)'
      eemt 'tremolo speed (beats per second):depth (percent)'
      ef1  'center frequency:width (Hz)'
      ef3  'cutoff frequency:resonance:gain'
      ef4  'cutoff:resonance'
      efa  'delay (samples):feedback (percent)'
      efc  'delay (samples):radius (0-1.0)'
      efb  'center frequency:width (Hz)'
      efi  'delay (samples):radius (0-1.0)'
      efr  'center frequency:width (Hz)'
      efs  'center frequency:width (Hz)'
      erc  'from channel:to channel'
      etc  'delay time (msec):variance time (samples):feedback (percent):lfo frequency'
      ete  'room size (metres):feedback level (percent):amount of reverbed signal added to the original (wet) (percent)'
      etl  'delay time (msec):variance time (samples):feedback (percent):lfo frequency'
      etm  'delay time (msec):number of delays:mix (wet) (percent)'
      etp  'delay time (msec):variance time (samples):feedback (percent):lfo frequency'
      etr  'delay time (msec):surround mode:feedback (percent)'
      el   'unique LADSPA name/number'
      gc   'start time (seconds):length (seconds)'
    )
    str=$msgs[$state]
    while compset -P 1 '*,'; do
      str="${str#*:}"
    done
    _message "${str%%:*}"
  ;;      
esac