head	1.6;
access;
symbols
	rel-0-2-1:1.4
	before_adj_struct:1.3.2.3
	jack:1.3.0.2
	rel-0-1-0:1.2
	rel-0-0-0:1.1;
locks; strict;
comment	@ * @;


1.6
date	2007.03.22.20.55.43;	author robertatwood;	state Exp;
branches;
next	1.5;

1.5
date	2006.04.23.22.03.14;	author robertatwood;	state Exp;
branches;
next	1.4;

1.4
date	2006.04.05.21.53.36;	author robertatwood;	state Exp;
branches;
next	1.3;

1.3
date	2005.08.20.18.26.43;	author robertatwood;	state Exp;
branches
	1.3.2.1;
next	1.2;

1.2
date	2005.04.03.20.05.39;	author robertatwood;	state Exp;
branches;
next	1.1;

1.1
date	2004.04.16.11.36.56;	author robertatwood;	state Exp;
branches;
next	;

1.3.2.1
date	2005.12.28.01.34.16;	author robertatwood;	state Exp;
branches;
next	1.3.2.2;

1.3.2.2
date	2005.12.29.00.20.53;	author robertatwood;	state Exp;
branches;
next	1.3.2.3;

1.3.2.3
date	2006.01.04.00.06.03;	author robertatwood;	state Exp;
branches;
next	1.3.2.4;

1.3.2.4
date	2006.04.05.21.42.24;	author robertatwood;	state Exp;
branches;
next	;


desc
@@


1.6
log
@Updated GPL text to reflect new address of Free Software foundation
Prepare to move repository to savannah.nongnu.org
@
text
@/**************************************************************
This file is part of the Variseq program.
Variseq -- a variable pitch and step sample sequencer
Copyright (C) 2004  Robert Atwood r.atwood (at) imperial (dot) ac (dot) uk

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 2
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, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 
See the file COPYING for more information
**************************************************************/


#include <malloc.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include "myFl.h"
#include "pattern.h"
#include "callbacks.h"



   


extern ctrl **sliders; 
extern pattern * thepattern;
extern Fl_Value_Input * speed;
extern Fl_Value_Input * msmooth;
extern Fl_Slider * mvol;
extern Fl_Output * bsize_disp;
/*
extern Fl_Output * bar_disp;
*/
extern Fl_Round_Button * rewrite_button;

Fl_Window *pwin;
Fl_Window * popup();
int * whichone = new int;
int * whichbutton = new int;

/* popup window for selecting which sample goes in this note */
/* initially it has no buttons, buttons get added as samples get chosen */
Fl_Window * popup(){
   Fl_Window * window = new Fl_Window( 50,50,50,50,"Choose");
   int thisy=MARGIN;
   int thisx=MARGIN;
   thisy += MARGIN;
   thisx += SWIDTH + MARGIN;
   window->size(thisx,thisy);
   return(window);
}
   
/* popup window for displaying the sample name */
/* initially it has no buttons, buttons get added as samples get chosen */
Fl_Window * fwindow(){
   Fl_Window * window = new Fl_Window( 50,200,50, 50,"Samples");
   int thisy=MARGIN;
   int thisx=MARGIN;
   thisy += MARGIN+SWIDTH;
   thisx += SWIDTH + 200 + MARGIN;
   window->size(thisx,thisy);
   Fl_Box * fbox = new Fl_Box(MARGIN,MARGIN,SWIDTH,SWIDTH,"F");
   Fl_Box * ibox = new Fl_Box(SWIDTH + MARGIN,MARGIN,SWIDTH,SWIDTH,"I");
   Fl_Box * bbox = new Fl_Box(2 * SWIDTH + MARGIN,MARGIN,SWIDTH,SWIDTH,"B");


   return(window);
}


/* assemble the main window slider group*/
Fl_Window * makewindow(int nsliders,int nlevels){
   int sstep = SWIDTH + SSPACE;
   int bsize = SWIDTH  ;
   int csize;
   int thisy = MARGIN + MENU;
   int thisx = MARGIN+SLABEL ;
   char * nlabel;
   nlabel = (char *) calloc(6,sizeof(char));
   #ifdef CRAPTOP
   Fl_Box * rbox = new Fl_Box (0,0,640,480);
   #else
   Fl_Box * rbox = new Fl_Box (0,0,1024,768);
   #endif

   pwin=popup();
   Fl_Window *window = new Fl_Window(MARGIN + RCTRLS + MARGIN+ (nsliders * sstep) + MARGIN  ,MARGIN + bsize + SHEIGHT+SLABEL+MARGIN);
   csize = 6*SWIDTH + SHEIGHT + SLABEL;
   int i;
   char  name[4],*n;

   sliders = new ctrl * [nsliders];
   thisy = 4*MARGIN;
   /* the master speed control */
   speed = new Fl_Value_Input(thisx,thisy,RCTRLS,RCTRLS/3,"s");
   speed->precision(2);
   speed->minimum(SP_MIN);
   speed->maximum(SP_MAX);
   speed->step(0.01);
   speed->soft(0);
   speed->callback(sp_cb,(void *)(thepattern));
   speed->value(120);
   speed->when(FL_WHEN_RELEASE);
   thisy += (RCTRLS /3 );
   thisy += MARGIN;
   /* the master smooth control */
   msmooth = new Fl_Value_Input(thisx,thisy,RCTRLS,RCTRLS/3,"%");
   msmooth->precision(2);
   msmooth->minimum(0);
   msmooth->maximum(20);
   msmooth->step(0.01);
   msmooth->soft(0);
   msmooth->callback(msmooth_cb,(void *)(thepattern));
   msmooth->value(1.0);
   thisy += (RCTRLS /3 );
   thisy += MARGIN;

   /* the master volume control */
   int vheight=3*SWIDTH;
   #ifdef COMPACT
   vheight = SWIDTH;
   #endif

   mvol = new Fl_Slider(thisx+MARGIN,thisy,SWIDTH,vheight,"V");
   mvol->type(FL_VERT_FILL_SLIDER);
   mvol->minimum(2);
   mvol->maximum(-4);
   mvol->value(0);
   mvol->selection_color(FL_GREEN);
   mvol->callback(mvol_cb,(void *)(thepattern));


   thisy += vheight;
   thisy += MARGIN;

   /* the rewrite button */
   window->add(rewrite_button);
   rewrite_button->resize(thisx-(MARGIN/2),thisy,SWIDTH,SWIDTH);
   rewrite_button->label("R");
   rewrite_button->callback(rewrite_cb,(void *)(thepattern));
   thisy += SWIDTH;
   thisy += MARGIN;

   /* buffersize display Frames*/
   window->add(bsize_disp);
   bsize_disp->resize(thisx-(MARGIN/2),thisy,RCTRLS+MARGIN,SWIDTH);
   bsize_disp->label("F");
   bsize_disp->color(FL_LIGHT1);

   #ifndef COMPACT
   thisy+= SWIDTH;
   #endif
   /* bar number display */
   /*
   window->add(bar_disp);
   bar_disp->resize(thisx-(MARGIN/2),thisy,RCTRLS+MARGIN,SWIDTH);
   bar_disp->label("B");
   bar_disp->color(FL_LIGHT1);
   */
   


   /* start at the top again, adding the control sliders */
   thisx +=RCTRLS;
   thisx+=MARGIN;
   int nscroll=20;
   int prescroll;

   if (nsliders<nscroll){
      nscroll=nsliders;
   }
   prescroll=thisx;
   Fl_Scroll * scroller= new Fl_Scroll(prescroll,MARGIN+SWIDTH,nscroll*sstep,csize+MARGIN/2,"");
   scroller->box(FL_FLAT_BOX);
   for (i=0;i<nsliders;i++){
      snprintf(nlabel,6,"%i",i);
      #ifndef NOPRINT
      printf("nlabel %s\n",nlabel);
      #endif
      thisy = MARGIN;


      sliders[i] = new ctrl(thisx ,thisy + bsize , SWIDTH+MARGIN, csize,"");

      sliders[i]->myname = strdup(nlabel);

      sliders[i]->mynum(i);
      sliders[i]->sampbut.callback(press);
      sliders[i]->pan.callback(rpan_cb);
      sliders[i]->vol.callback(rvol_cb);
      sliders[i]->clip.callback(rclip_cb);
      sliders[i]->note.callback(note_slider_cb);

      sliders[i]->nlen.callback(nlen_cb);
      sliders[i]->nlen.label(sliders[i]->myname);

      sliders[i]->oct.callback(noct_cb);

      sliders[i]->mynum(i);


      snprintf(name,4,"%i",i+1);
      printf("%i %s\n",i+1,name);
      n=strdup(name);
     // sliders[i]->notelabel(n) ;
      sliders[i]->setlevels(nlevels);
      thisx += sstep;
   }
   scroller->end();

   thisx = nscroll* sstep + prescroll;
   thisy +=  csize;
   thisx += MARGIN;
   thisy += MARGIN + SLABEL ;
   window->size(thisx,thisy+MARGIN);
   #ifndef NOPRINT
   printf("x,y: %i %i \n",thisx,thisy+MARGIN);
   #endif
   window->end();
   window->resizable(NULL);
   free (nlabel);
   return(window);
}
   
/* $Id: slider.C,v 1.5 2006/04/23 22:03:14 robertatwood Exp $ */
@


1.5
log
@Fixed popup window location and sample name label
@
text
@d18 1
a18 1
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
d22 1
d237 1
a237 1
/* $Id: slider.C,v 1.4 2006/04/05 21:53:36 robertatwood Exp $ */
@


1.4
log
@Jack version is the main branch now
@
text
@d127 1
a127 1
   thisy += 2*MARGIN;
d130 6
a135 1
   mvol = new Fl_Slider(thisx+MARGIN,thisy,SWIDTH,3*SWIDTH,"V");
d144 2
a145 2
   thisy += 2*SWIDTH;
   thisy += 2*SWIDTH;
d153 1
a153 1
   thisy += SWIDTH;
d161 1
d163 1
d184 1
a184 1
   Fl_Scroll * scroller= new Fl_Scroll(prescroll,MARGIN+SWIDTH,nscroll*sstep,csize+MARGIN,"");
d236 1
a236 1
/* $Id: slider.C,v 1.3.2.4 2006/04/05 21:42:24 robertatwood Exp $ */
@


1.3
log
@Added a save/restore workspace function
Added window to display names of samples
@
text
@d42 3
d50 1
d64 1
a64 1
/* popup window for selecting which sample goes in this note */
d70 1
a70 1
   thisy += MARGIN;
d73 4
d89 7
d114 1
d129 1
d142 1
a146 1

d150 1
d157 7
d167 1
d170 9
d180 4
d188 3
d199 1
d213 1
d215 1
d219 4
a222 1
   window->size(thisx,thisy);
d224 2
d229 1
a229 1
/* $Id: slider.C,v 1.3 2005/08/20 18:23:08 robert Exp $ */
@


1.3.2.1
log
@Began sample-replace segment
@
text
@a46 1
int * whichbutton = new int;
d60 1
a60 1
/* popup window for displaying the sample name */
d179 1
a179 1
/* $Id: slider.C,v 1.3 2005/08/20 18:26:43 robertatwood Exp $ */
@


1.3.2.2
log
@Input capture working with as compile time #ifdef
@
text
@a125 1
   /* the rewrite button */
d180 1
a180 1
/* $Id: slider.C,v 1.3.2.1 2005/12/28 01:34:16 robertatwood Exp $ */
@


1.3.2.3
log
@Jack input as well, and scrambling in compile-time option
@
text
@a41 1
extern Fl_Output * bar_disp;
d67 1
a67 1
   thisy += MARGIN+SWIDTH;
a69 4
   Fl_Box * fbox = new Fl_Box(MARGIN,MARGIN,SWIDTH,SWIDTH,"F");
   Fl_Box * ibox = new Fl_Box(SWIDTH + MARGIN,MARGIN,SWIDTH,SWIDTH,"I");
   Fl_Box * bbox = new Fl_Box(2 * SWIDTH + MARGIN,MARGIN,SWIDTH,SWIDTH,"B");

a113 1
   /* the master volume control */
d131 1
a134 1
   /* buffersize display Frames*/
a140 5
   /* bar number display */
   window->add(bar_disp);
   bar_disp->resize(thisx-(MARGIN/2),thisy,RCTRLS+MARGIN,SWIDTH);
   bar_disp->label("B");
   bar_disp->color(FL_LIGHT1);
a143 1
   /* start at the top again, adding the control sliders */
d181 1
a181 1
/* $Id: slider.C,v 1.3.2.2 2005/12/29 00:20:53 robertatwood Exp $ */
@


1.3.2.4
log
@Jack or portaudio version with compile-time selection
Autoscramblizer option , input option
@
text
@a41 1
/*
a42 1
*/
a86 7
   char * nlabel;
   nlabel = (char *) calloc(6,sizeof(char));
   #ifdef CRAPTOP
   Fl_Box * rbox = new Fl_Box (0,0,640,480);
   #else
   Fl_Box * rbox = new Fl_Box (0,0,1024,768);
   #endif
a104 1
   speed->when(FL_WHEN_RELEASE);
a147 1
   /*
a151 1
   */
a157 9
   int nscroll=20;
   int prescroll;

   if (nsliders<nscroll){
      nscroll=nsliders;
   }
   prescroll=thisx;
   Fl_Scroll * scroller= new Fl_Scroll(prescroll,MARGIN+SWIDTH,nscroll*sstep,csize+MARGIN,"");
   scroller->box(FL_FLAT_BOX);
a158 4
      snprintf(nlabel,6,"%i",i);
      #ifndef NOPRINT
      printf("nlabel %s\n",nlabel);
      #endif
a162 3

      sliders[i]->myname = strdup(nlabel);

a170 1
      sliders[i]->nlen.label(sliders[i]->myname);
a183 1
   scroller->end();
a184 1
   thisx = nscroll* sstep + prescroll;
d188 1
a188 4
   window->size(thisx,thisy+MARGIN);
   #ifndef NOPRINT
   printf("x,y: %i %i \n",thisx,thisy+MARGIN);
   #endif
a189 2
   window->resizable(NULL);
   free (nlabel);
d193 1
a193 1
/* $Id: slider.C,v 1.3.2.3 2006/01/04 00:06:03 robertatwood Exp $ */
@


1.2
log
@Changed the buffer writing so that samples extend into unused notes.
Altered file choose usage to correctly use the FLTK chooser
@
text
@d60 12
d179 1
a179 1
/* $Id: slider.C,v 1.2 2005/04/03 19:05:10 robert Exp $ */
@


1.1
log
@Initial version uploaded to Sourceforge
@
text
@d42 1
a107 1
   thisy += 3*SWIDTH;
d109 11
a119 1
   thisy += 3*SWIDTH;
d124 1
d167 1
a167 1
/* $Id: slider.C,v 1.10 2004/04/12 13:22:33 robert Exp $ */
@

