This file is indexed.

/usr/share/bse/v0.7.8/scripts/song-parts-operations.scm is in beast 0.7.8-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 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
;; CC0 Public Domain: http://creativecommons.org/publicdomain/zero/1.0/
;;
;; (bse-script-register <func> <options> <category> <blurb> <author> <license> ARGS...)
;;
(bse-script-register 'song-parts-crop
		     ""
                     (N_ "/Song/Crop parts (loop range)")
		     (N_ "Crops all parts within the loop range "
			 "and moves parts after the loop range backwards accordingly.")
		     "Stefan Westerfeld"
		     "Provided \"as is\", WITHOUT ANY WARRANTY"
		     (bse-param-song (N_ "Song")))
(bse-script-register 'song-parts-duplicate
		     ""
                     (N_ "/Song/Duplicate parts (loop range)")
		     (N_ "Duplicate all parts within the loop range "
			 "and moves parts after the loop range forward accordingly.")
		     "Stefan Westerfeld"
		     "Provided \"as is\", WITHOUT ANY WARRANTY"
		     (bse-param-song (N_ "Song")))
;; common code for duplicate & crop:
;; error checking, computing boundaries, undo, applying algorithm to each track
(define (song-parts-operation song errtitle operation)
  (if (not (bse-is-song song))
      (bse-exit-error 'text1 (_ "No valid song supplied")))
  (let* ((marker1 (max 0 (bse-item-get song "loop-left")))  ; handle loop marker -1 (unset) as 0 (set to start)
         (marker2 (max 0 (bse-item-get song "loop-right")))
	 (start   (min marker1 marker2))                    ; sort markers
	 (end     (max marker1 marker2))
	 (len     (- end start))
	 (process-track
	   (lambda (track)
	     (if (bse-is-track track)
	       (operation track start end len)))))
    (if (> end start)
      (begin
	(bse-item-group-undo song "song-parts-operation")
        (for-each process-track (bse-container-list-children song))
        (bse-item-ungroup-undo song))
      (bse-exit-message 'warning
			'text1 errtitle
			'text2 (_ "The loop range of the specified song contains no parts "
				  "or is unset, so no parts can be identified to operate on.")
			'check (_ "Show messages about empty part range")))))
;; algorithm for cropping parts
(define (song-parts-crop song)
  (song-parts-operation song (_ "Failed to crop part range.")
    (lambda (track start end len)
      (for-each
        (lambda (track-part) (let ((tick (bse-rec-get track-part 'tick))
				   (part (bse-rec-get track-part 'part)))
				  (cond ((>= tick end)   (bse-track-insert-part track (- tick len) part)
						         (bse-track-remove-tick track tick))
				        ((>= tick start) (bse-track-remove-tick track tick)))))
        (bse-track-list-parts track)))))
;; algorithm for duplication of parts
(define (song-parts-duplicate song)
  (song-parts-operation song (_ "Failed to duplicate part range.")
    (lambda (track start end len)
      (for-each
        (lambda (track-part) (let ((tick (bse-rec-get track-part 'tick))
				   (part (bse-rec-get track-part 'part)))
				  (cond ((>= tick end)   (bse-track-insert-part track (+ tick len) part)
						         (bse-track-remove-tick track tick))
				        ((>= tick start) (bse-track-insert-part track (+ tick len) part)))))
        (reverse (bse-track-list-parts track))))))
;; vim:set sw=2 sts=2 ts=8: