Welcome to %s forums

BrainModular Users Forum

Login Register

presetmanager in hollyhock question

I need help on a Patch
Post Reply
funkyguitarist
Member
Posts: 40
Contact:

Unread post by funkyguitarist » 19 Sep 2013, 22:31

hello

i tried the preset manager in hollyhock and found its not working the way its supposed to
when i use patches containing other patches.

in usine 5 i m having no problems with this.

has someone experienced the same or am i am doing something wrong?



cheers
mark

ceasless
Member
Posts: 330
Contact:

Unread post by ceasless » 22 Sep 2013, 19:20

Honestly I've never been able to integrate the Preset Manager into my current project (which is a drum sequencer, almost finished! I'm very excited to share with everyone).

The Preset Manager simply remains ignorant of the fact that there are multiple step sequencers and a sequenced switch to keep track of. That is, storing into a preset does not mean anything, as switching presets just carries over whatever is currently in the sequencers. Recalling a preset that had different values saved previously doesn't do anything, it just carries over the current values too.

Here is a 'Pattern Store' script I wrote in order to save the array values of the sequencers, in case it helps somehow:

Code: Select all

//////////////////////////
// Pattern Store  
/////////////////////////
// parameters declaration

const PATTERNs = 8;
const STEPs = 32;
const IOs = 9;                 
                                         
var MEMs : integer;
                                      
type tStep    = array [0..STEPs-1] of single;
type stepBank = array [0..IOs-1] of tStep;    
var  patternBank : array of stepBank;
var  memory   : array [0..(PATTERNs*IOs)-1] of tParameter;
var  stepIn   : array of integer;
var  stepOut  : array of integer;
var  store    : tParameter;
var  load     : tParameter; 
var  stepNum  : tParameter;  
var  current  : tParameter;
var  copy     : tParameter;
//var  copys    : tParameter;
var  resetP   : tParameter;
var  resetA   : tParameter;                    
                     
var  p,i,n,s  : integer;                     
                                       
// initialisation : create parameters
procedure init;
begin
  MEMs := PATTERNs * IOs;
  writeln('length of all my MEMs '+inttostr(MEMs));
                            
  setArrayLength(patternBank,PATTERNS);
  setArrayLength(stepIn,IOs);                  
  setArrayLength(stepOut,IOs);
  
  store := createParam('store',ptButton);
  setIsOutput(store,false);
  load  := createParam('load',ptDataField);
  setIsOutput(load,false);
  
  copy  := createParam('copy',ptSwitch);
  setIsOutput(copy,false);
  setIsSeparator(copy,true);
// copys := createParam('copy store',ptButton);
// setIsInput(copys,false);
                                
  stepNum := createParam('step num',ptDataField);
  setIsSeparator(stepNum,true);        
  
  current := createParam('current',ptDataField);
  setIsInput(current,false);    
  setIsOutput(current,false);
  
  resetP := createParam('reset pattern',ptButton);
  setIsOutput(resetP,false);
  
  resetA := createParam('reset all',ptButton);
  setIsOutput(resetA,false);
  
  for i := 0 to IOs-1                
  do begin                                                          
    stepIn[i] := createParam('seq '+inttostr(i+1),ptArray);
    setIsOutput(stepIn[i],false); 
    
    for s:=0 to STEPs-1
    do begin
      setDataArrayValue(stepIn[i],s,0);
    end;                
    setLength(stepIn[i],STEPs);  
  end;                                                     
  setIsSeparator(stepIn[0],true);  
  
  for i := 0 to IOs-1                
  do begin
    stepOut[i] := createParam('seq '+inttostr(i+1),ptArray);
    setIsInput(stepOut[i],false);   
    
    for s:=0 to STEPs-1
    do begin
      setDataArrayValue(stepOut[i],s,0);
    end;                
    setLength(stepOut[i],STEPs);  
  end;
  
  for i:=0 to MEMs-1                            
  do begin
    memory[i] := createParam('mem '+inttostr(i+1),ptArray);
    setIsInput(memory[i],false);
    setIsOutput(memory[i],false);
    setDontSave(memory[i],false);

    setLength(memory[i],STEPs);    
    // i hope this only happens once, at the very beginning
    for s:=0 to STEPs-1
    do begin
      setDataArrayValue(memory[i],s,0);
    end;
  end;
  
  writeln('initted');
  // load will hold a value from a switch group,
  // so it will begin with a value.
//  setvalue(current, getValue(load)); 
end;                                              

 
var choice,next,                                                           
    prev, x, m   : integer;
var v            : single;
var temp         : tStep;
// Callbackprocedure      
Procedure Callback(N:integer);
begin 
  case N of
  
    resetP: begin   
      choice := round(getValue(current));
      writeln('reset pattern '+inttostr(choice));
      setLength(stepOut[choice],STEPs);
      setLength(memory[choice],STEPs);
        for s:=0 to STEPs-1
        do begin
          setDataArrayValue(memory[choice],s,0);
          setDataArrayValue(stepOut[choice],s,0);
        end;                                    
    end; 
    
    resetA: begin             
      writeln('resetting all patterns');
      for m:=0 to MEMs-1
      do begin
        for s:=0 to STEPs-1
        do begin
          setDataArrayValue(memory[m],s,0);
        end;                             
      end;
    end;              
      
    copy: begin
      choice := round(getvalue(copy));
      writeln('copy is '+inttostr(choice));
                                                       
//      setValue( copys, choice );
    end;
    
    store: begin 
      choice := round( getValue(load) );
      for i := 0 to IOs-1
      do begin
        m := ((choice-1) * PATTERNs) + i;
        writeln('storing in '+inttostr(m));
        setLength(stepOut[i],STEPs);
        setLength(memory[m],STEPs);          
        for s := 0 to STEPs-1
        do begin
          temp[s] := getDataArrayValue(stepIn[i],s);
          setDataArrayValue(memory[m],s,temp[s]);
          setDataArrayValue(stepOut[i],s,temp[s]);
        end;
      end; 
    end;//store
                
    stepNum: begin
      if getValue(stepNum) = 1
      then begin
        next := round( getValue(load) );
        prev := round( getValue(current) );   
        if next <> prev                     
        then begin  
           writeln&#40;'setting current to load'&#41;;       
          setValue&#40;current, next&#41;;
        end;
      end
      else if getValue&#40;stepNum&#41; = 31 
      then begin
        next &#58;= round&#40; getValue&#40;load&#41; &#41;;
        prev &#58;= round&#40; getValue&#40;current&#41; &#41;;   
        if next <> prev                   
        then begin                
          for i&#58;=0 to IOs-1
          do begin
            n &#58;= &#40;&#40;next-1&#41; * IOs&#41; + i;       
            writeln&#40;'getting values from '+inttostr&#40;n&#41;&#41;; 
            setLength&#40;stepOut&#91;i&#93;,STEPs&#41;;        
            for s&#58;=0 to STEPs-1
            do begin 
              temp&#91;s&#93; &#58;= getDataArrayValue&#40;memory&#91;n&#93;,s&#41;;
              setDataArrayValue&#40;stepOut&#91;i&#93;,s,temp&#91;s&#93;&#41;;                        
            end;                                                         
          end;                  
          setValue&#40;current,next&#41;;
        end;
      end;     
    end;//stepNum
    
    // this case handles 'copy to new pattern'
    load&#58; begin
      prev &#58;= round&#40; getValue&#40;current&#41;&#41;;
      for i&#58;=0 to IOs-1
      do begin                       
        p &#58;= &#40;&#40;prev-1&#41; * IOs&#41; + i;   
        writeln&#40;'auto-saving into '+inttostr&#40;p&#41;&#41;;                
        setLength&#40;memory&#91;p&#93;,STEPs&#41;; 
        setLength&#40;stepOut&#91;i&#93;,STEPs&#41;;
        for s&#58;=0 to STEPs-1
        do begin
          temp&#91;s&#93; &#58;= getDataArrayValue&#40;stepIn&#91;i&#93;,s&#41;;
          setDataArrayValue&#40;memory&#91;p&#93;,s,temp&#91;s&#93;&#41;;
          setDataArrayValue&#40;stepOut&#91;i&#93;,s,temp&#91;s&#93;&#41;;
        end;
      end;
 
      choice &#58;= round&#40; getValue&#40;copy&#41; &#41;;
      if choice = 1
      then begin
        next &#58;= round&#40; getValue&#40;load&#41; &#41;;
        prev &#58;= round&#40; getValue&#40;current&#41; &#41;;                    
        for i&#58;=0 to IOs-1                    
        do begin
          n &#58;= &#40;&#40;next-1&#41; * IOs&#41; + i;
          p &#58;= &#40;&#40;prev-1&#41; * IOs&#41; + i;
          writeln&#40;'loading from '+inttostr&#40;p&#41;+' into '+inttostr&#40;n&#41;&#41;;
          setLength&#40;memory&#91;n&#93;,STEPs&#41;;                  
          for s&#58;=0 to STEPs-1
          do begin
            temp&#91;s&#93; &#58;= getDataArrayValue&#40;memory&#91;p&#93;,s&#41;;
            setDataArrayValue&#40;memory&#91;n&#93;,s,temp&#91;s&#93;&#41;;  
          end;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
        end;  
        // Don't leave copy on!
        setValue&#40;copy,0&#41;;                   
      end;
    end;
                 
  end;
end;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
                                                                 
// Global variables               
//var loadPattern &#58; integer;
//var stepPos &#58; integer;                  
//////////////////////////////
// main proc                                                       
//////////////////////////////                                          
Procedure Process;
begin                                                    
  // v2
end;

Post Reply

Who is online

Users browsing this forum: No registered users and 76 guests