FR: Sample End

Lytz1
Posts: 45
Joined: 10 Aug 2020 16:55

Re: FR: Sample End

Post by Lytz1 »

kjetil wrote: 12 Nov 2020 12:44
kjetil wrote: 12 Nov 2020 12:42
kjetil wrote: 12 Nov 2020 12:38

It has an impact on instruments that has loop points different places in more than one sample. One hack to work around this would be to disable the ability to set loop start/end points for such instruments. Guess i'll do that.
Oh, sorry, just End, not loop end? Sure, that is possible.
But note that if the sample has custom loop start and end points, those will be used for looping when looping is enabled, not sample start and sample end.
That wouldn't be any problem, as the samples that DO use already custom loop points should be ready to use
in that way anyway. It's for everything else and a lot (!) of sample libraries do not have any loop points embedded.
Lytz1
Posts: 45
Joined: 10 Aug 2020 16:55

Re: FR: Sample End

Post by Lytz1 »

kjetil wrote: 12 Nov 2020 12:47 Note that the ra:set-instrument-loop-data function might cause crash in peak rendering code, I think it was, for extreme or illegal values, so you should be a little careful. And no need to send crash reports. I'll fix this though. The function was made for the tracker module importer only, i.e. it is more of an internal function, so it hasn't been tested for illegal and extreme values.

Alright I see. I'll try this out anyway. Might be also very useful. But still I think that a simple slider to adjust the end of the
sample will go a long way already.
Lytz1
Posts: 45
Joined: 10 Aug 2020 16:55

Re: FR: Sample End

Post by Lytz1 »

kjetil wrote: 11 Nov 2020 14:57 That's what the function "ra.setInstrumentLoopData" does by the way. Here's a quick GUI for it:

Code: Select all

(let ()
  (define has-started #f)
  (define start 0)
  (define end 1)
  (define (set2)
    (if has-started
        (<ra> :set-instrument-loop-data (<ra> :get-current-instrument) start (- end start))))
  (define slider1 (<gui> :horizontal-int-slider "Start:" 0 0 48000 (lambda (asdf)
                                                                     (set! start asdf)
                                                                     (set2))))
  (define slider2 (<gui> :horizontal-int-slider "End" -5 10 48000 (lambda (asdf)
                                                                    (set! end asdf)
                                                                    (set2))))
  (define group (<gui> :group "stuff"
                       (<gui> :vertical-layout
                              slider1
                              slider2)))
  (<gui> :show group)
  (<gui> :set-parent group -1)
  (set! has-started #t))


Calling this function results in this error:

Code: Select all

2020-11-12 15:20:49:
error: unbound-variable unbound variable open-loop-editor in (open-loop-editor)

error-code: (open-loop-editor)

error-file/line: #f[673]

error-history: 

"(open-loop-editor)"

1:    
"(apply func args)"
;init.scm[318] 
3:    
"(FROM-C-catch-all-errors-and-display-backtrace-automatically eval-string "(open-loop-editor)")"


(args "(open-loop-editor)") (func . eval-string) 
Any ideas?
kjetil
Site Admin
Posts: 582
Joined: 20 Jul 2017 20:45

Re: FR: Sample End

Post by kjetil »

Yes, seems like you copied the wrong code block into your .scm file.
Lytz1
Posts: 45
Joined: 10 Aug 2020 16:55

Re: FR: Sample End

Post by Lytz1 »

kjetil wrote: 12 Nov 2020 14:26 Yes, seems like you copied the wrong code block into your .scm file.
not this one? --->

Code: Select all

(define (open-loop-editor)
  (define has-started #f)
  (define start 0)
  (define end 1)
  (define (set2)
    (if has-started
        (<ra> :set-instrument-loop-data (<ra> :get-current-instrument) start (- end start))))
  (define slider1 (<gui> :horizontal-int-slider "Start:" 0 0 48000 (lambda (asdf)
                                                                     (set! start asdf)
                                                                     (set2))))
  (define slider2 (<gui> :horizontal-int-slider "End" -5 10 48000 (lambda (asdf)
                                                                    (set! end asdf)
                                                                    (set2))))
  (define group (<gui> :group "stuff"
                       (<gui> :vertical-layout
                              slider1
                              slider2)))
  (<gui> :show group)
  (<gui> :set-parent group -1)
  (set! has-started #t))
Lytz1
Posts: 45
Joined: 10 Aug 2020 16:55

Re: FR: Sample End

Post by Lytz1 »

ah, I think I forgot the 'let'....
Lytz1
Posts: 45
Joined: 10 Aug 2020 16:55

Re: FR: Sample End

Post by Lytz1 »

No, that wasn't it. Now what? Haha. :) Which one is it then?
kjetil
Site Admin
Posts: 582
Joined: 20 Jul 2017 20:45

Re: FR: Sample End

Post by kjetil »

Lytz1 wrote: 12 Nov 2020 16:12
kjetil wrote: 12 Nov 2020 14:26 Yes, seems like you copied the wrong code block into your .scm file.
not this one? --->

Code: Select all

(define (open-loop-editor)
  (define has-started #f)
  (define start 0)
  (define end 1)
  (define (set2)
    (if has-started
        (<ra> :set-instrument-loop-data (<ra> :get-current-instrument) start (- end start))))
  (define slider1 (<gui> :horizontal-int-slider "Start:" 0 0 48000 (lambda (asdf)
                                                                     (set! start asdf)
                                                                     (set2))))
  (define slider2 (<gui> :horizontal-int-slider "End" -5 10 48000 (lambda (asdf)
                                                                    (set! end asdf)
                                                                    (set2))))
  (define group (<gui> :group "stuff"
                       (<gui> :vertical-layout
                              slider1
                              slider2)))
  (<gui> :show group)
  (<gui> :set-parent group -1)
  (set! has-started #t))
Yes, that's the correct one.
Lytz1
Posts: 45
Joined: 10 Aug 2020 16:55

Re: FR: Sample End

Post by Lytz1 »

kjetil wrote: 12 Nov 2020 16:16
Lytz1 wrote: 12 Nov 2020 16:12
kjetil wrote: 12 Nov 2020 14:26 Yes, seems like you copied the wrong code block into your .scm file.
not this one? --->

Code: Select all

(define (open-loop-editor)
  (define has-started #f)
  (define start 0)
  (define end 1)
  (define (set2)
    (if has-started
        (<ra> :set-instrument-loop-data (<ra> :get-current-instrument) start (- end start))))
  (define slider1 (<gui> :horizontal-int-slider "Start:" 0 0 48000 (lambda (asdf)
                                                                     (set! start asdf)
                                                                     (set2))))
  (define slider2 (<gui> :horizontal-int-slider "End" -5 10 48000 (lambda (asdf)
                                                                    (set! end asdf)
                                                                    (set2))))
  (define group (<gui> :group "stuff"
                       (<gui> :vertical-layout
                              slider1
                              slider2)))
  (<gui> :show group)
  (<gui> :set-parent group -1)
  (set! has-started #t))
Yes, that's the correct one.
Well, ok, this was copied back to here straight out of my myscheme.scm file.
Then I don't know what's wrong.
Doesn't really matter. The sample end implementation will be more useful anyways I think.
kjetil
Site Admin
Posts: 582
Joined: 20 Jul 2017 20:45

Re: FR: Sample End

Post by kjetil »

The error message said that there was no open-loop-editor function, so either there is an error in myscheme.scm (causing the file to fail loading), or myscheme.scm isn't loaded at all. You could try to move the function to the top of myscheme.scm, or just move it into one of the .scm files in bin/scheme/ in the program.
Post Reply