Subject: Re: [ecasound] eci / ecamonitor / -ev
From: Mario Lang (mlang_AT_delysid.org)
Date: Wed Nov 06 2002 - 16:56:54 EET
Adam Linson <adam_AT_semioweb.com> writes:
[...]
> is it possible to "harvest" the values from "-ev" for use in an ECI
> implementation?
Yes, of course.
> concretely: in the ECI example at
> http://www.wakkanet.fi/~kaiv/ecasound/Documentation/programmers_guide/html_ecidoc/eci_doc.htmlthe sample position is checked, and a conditional command is issued,
> depending on the sample position. is it possible, with ECI, to check
> various amplitude statistics (as with "-ev"/ecamonitor) and use (the
> many aspects of) that information in conditions for issuing commands as
> well?
>
> my guess is that it's a bit tricky, since the normal EIAM "-ev" waits
> for the sample to finish ("wait_for_stop ok"), and only with ecamonitor
> am i able to check the "-ev" values on a quasi-real-time basis.
Use cop-status instead of copp-get.
cop-status will include a line like this:
Status info:
(audiofx) -- Amplitude statistics -------
.......
So you only need to parse that out there.
ecasound.el implements that.
(defvar eci-cop-status-header
"### Chain operator status (chainsetup '\\([^']+\\)') ###\n")
(defun eci-process-cop-status (string)
(with-temp-buffer
(insert string) (goto-char (point-min))
(when (re-search-forward eci-cop-status-header nil t)
(let (result)
(while (re-search-forward "Chain \"\\([^\"]+\\)\":\n" nil t)
(let ((c (match-string-no-properties 1)) chain)
(while (re-search-forward
"\t\\([0-9]+\\)\\. \\(.+\\): \\(.*\\)\n?" nil t)
(let ((n (string-to-number (match-string 1)))
(name (match-string-no-properties 2))
(args
(mapcar
(lambda (elt)
(when (string-match
"\\[\\([0-9]+\\)\\] \\(.*\\) \\([0-9.-]+\\)$"
elt)
(list (match-string-no-properties 2 elt)
(string-to-number (match-string 1 elt))
(string-to-number (match-string 3 elt)))))
(split-string
(match-string-no-properties 3) ", "))))
(if (looking-at "\tStatus info:\n")
(setq args
(append
args
(list
(list
"Status info" nil
(buffer-substring
(progn (forward-line 1) (point))
(or (re-search-forward "\n\n" nil t)
(point-max))))))))
(setq chain (cons (append (list name n) args) chain))))
(setq result (cons (reverse (append chain (list c))) result))))
result))))
So to access the status info in elisp, do:
(nth 2 (nth 2 (nthcdr 2 (assoc "Volume analysis"
(assoc (car (eci-c-selected))
(eci-cop-status))))))
or something like that.
-- CYa, Mario | Debian Developer <URL:http://debian.org/> | Get my public key via finger mlang_AT_db.debian.org | 1024D/7FC1A0854909BCCDBE6C102DDFFC022A6B113E44
This archive was generated by hypermail 2b28 : Wed Nov 06 2002 - 16:53:55 EET