-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathcsound-skeleton.el
78 lines (64 loc) · 2.52 KB
/
csound-skeleton.el
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
;;; csound-skeleton.el --- A major mode for interacting and coding Csound
;; Copyright (C) 2017 - 2023 Hlöðver Sigurðsson
;; Author: Hlöðver Sigurðsson <[email protected]>
;; Version: 0.2.9
;; Package-Requires: ((emacs "25") (shut-up "0.3.2") (multi "2.0.1") (dash "2.16.0") (highlight "0"))
;; URL: https://github.com/hlolli/csound-mode
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; Skeleton for when creating new .csd file.
;; Initialize defaults values
(defcustom csound-skeleton-default-sr 44100
"Set the default sr value when creating new csound file."
:type 'integer
:group 'csound-mode)
(defcustom csound-skeleton-default-ksmps 32
"Set the default ksmps value when creating new csound file."
:type 'integer
:group 'csound-mode)
(defcustom csound-skeleton-default-options "-odac"
"Set the default option flags when creating new csound file."
:type 'string
:group 'csound-mode)
(defcustom csound-skeleton-default-additional-header ""
"Set the default additional header information when creating new csound file."
:type 'string
:group 'csound-mode)
(define-skeleton csound-skeleton-new-csd
"Skeleton for auto-insert in csound-mode."
nil
"<CsoundSynthesizer>\n"
"<CsOptions>\n"
(concat csound-skeleton-default-options)
"\n</CsOptions>\n"
"<CsInstruments>\n\n"
(concat "sr = " (number-to-string csound-skeleton-default-sr) "\n")
(concat "ksmps = " (number-to-string csound-skeleton-default-ksmps) "\n")
"nchnls = 2\n"
"0dbfs = 1.0\n"
"\n"
(concat csound-skeleton-default-additional-header)
"\n\n"
"instr 1\n\nendin\n\n"
"</CsInstruments>\n"
"<CsScore>\n"
"i1 0 1\n"
"</CsScore>\n"
"</CsoundSynthesizer>\n")
(eval-when-compile
(define-auto-insert "\\.csd\\'"
[csound-skeleton-new-csd (lambda ()
(goto-line 11)
(run-with-idle-timer 0.15 nil
(lambda () (csound-font-lock-flush-buffer))))]))
(provide 'csound-skeleton)
;;; csound-skeleton.el ends here