Esempio n. 1
0
void savap(char *pointer)
{
  FILE *out;

  *apf_tittle=0;
  strcat(apf_tittle,pointer);    
  
  if((out=fopen(apf_tittle,"wb"))==0) {
    *info=0; 
    strcat(info, "Error: Could not open ");
    strcat(info, apf_tittle);
    Popup(info);
    *apf_tittle=0;
    return;
  }

  if(fwrite(atsh_anargs,1,sizeof(ANARGS),out)==0) {
    *info=0; 
    strcat(info, "Error: Could not write on ");
    strcat(info, apf_tittle);
    Popup(info);
    *apf_tittle=0;
    fclose(out);
    return;
  }
  fclose(out);
  return;
}
Esempio n. 2
0
void getap(char *pointer)
{
  FILE *in;

  *apf_tittle=0;
  strcat(apf_tittle,pointer);    

  if((in=fopen(apf_tittle,"rb"))==0) {
    *info=0; 
    strcat(info, "Could not open ");
    strcat(info, apf_tittle);
    Popup(info);
    *apf_tittle=0;
    return;
  }
  
  if(fread(atsh_anargs,1,sizeof(ANARGS),in)==0) {
    *info=0; 
    strcat(info, "Error: Could not read ");
    strcat(info, apf_tittle);
    Popup(info);
    *apf_tittle=0;
    fclose(in);
    return;
  }
  update_aparameters();

  fclose(in);
  return;
}
Esempio n. 3
0
File: simug.c Progetto: chinacat/rs
void ExitSimu()
{
   char tmpstr[TEMPSTRINGLEN];
   Position x, y;
   Dimension width, height;
   Cardinal n = 0;
   Arg args[5];


   if (shellFlag == True)
      XtDestroyWidget(dialogShell);
   dialogShell = CreateShell();

   XtSetArg(dialog0Args[0], XtNlabel, "Quit the Simu system?");

   dialog0 = XtCreateManagedWidget("dialog0", dialogWidgetClass, dialogShell,
	        		   dialog0Args, XtNumber(dialog0Args));
   XtVaSetValues(dialog0, XtNfont, font1Struct, NULL);

   XawDialogAddButton(dialog0, "OK", ExitSimuOK, NULL); 
   XawDialogAddButton(dialog0, "Cancel", CancelDialog, dialog0);
   XawDialogAddButton(dialog0, "Help", ExitSimuHelp, NULL); 

   XtRealizeWidget(dialogShell);
   Popup(dialogShell, XtGrabNone);
/*   XtPopup(dialogShell, XtGrabNone); */
   shellFlag = True;
}
Esempio n. 4
0
  TopWindowStyle()
#if defined(ENABLE_SDL) && !defined(ANDROID)
    :full_screen(false), resizable(false)
#endif
  {
    Popup();
  }
Esempio n. 5
0
// /////////////////////////////////////////////////////////////////
// display_help
// /////////////////////////////////////////////////////////////////
void
HelpAgent::display_help (Widget w)
{
  char* locator_id=get_locator_id(w);
  if(locator_id == NULL)
  {
    message_mgr().error_dialog ((char*)UAS_String(
                  CATGETS(Set_Messages, 3, "No help available")));
    return;
  }

  Wait_Cursor bob;

  if (f_helper == NULL)
    create_ui();
  XtVaSetValues(f_helper,
                DtNhelpType, DtHELP_TYPE_TOPIC,
                DtNhelpVolume, "Infomgr",
                DtNlocationId, locator_id,
                XmNdialogStyle, XmDIALOG_MODELESS,
                NULL);

  XtManageChild(f_helper);
  Popup();
}
Esempio n. 6
0
LRESULT CDocWindow::OnRButtonUp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
	int x = GET_X_LPARAM(lParam);
	int y = GET_Y_LPARAM(lParam);

	// See if the selected object wants the event
	if (m_Select.RightClick(x, y))
		return S_OK;

	CMenu Menu;
	bool bOK = !!Menu.LoadMenu(SpecialsEnabled() ? IDR_POPUPMENU_EX : IDR_POPUPMENU);
	if (!bOK)
		return E_FAIL;

	CMenu Popup(Menu.GetSubMenu(0));
	if (!Popup.IsMenu())
		return E_FAIL;

	// Make sure the menu items are set correctly
//j	Popup.EnableMenuItem(1/*Add*/,              MF_BYPOSITION | (m_pAGDoc ? MF_ENABLED : MF_GRAYED));
//j	Popup.EnableMenuItem(IDC_DOC_NEW,           MF_BYCOMMAND | MF_ENABLED);
//j	Popup.EnableMenuItem(IDC_DOC_OPEN,          MF_BYCOMMAND | MF_ENABLED);
//j	Popup.CheckMenuItem(IDC_DOC_LOCKED,		    MF_BYCOMMAND | (m_pAGDoc && m_Select.SymIsImage() && m_Select.SymIsLocked() ? MF_CHECKED : MF_UNCHECKED));

	CPoint point;
	::GetCursorPos(&point);
	m_bIgnoreSetCursor = true;
	Popup.TrackPopupMenu(TPM_LEFTALIGN|TPM_TOPALIGN|TPM_LEFTBUTTON|TPM_RIGHTBUTTON, point.x, point.y, m_hWnd);
	Menu.DestroyMenu();
	m_bIgnoreSetCursor = false;

	return S_OK;
}
Esempio n. 7
0
sBool sBrowserList::OnCommand(sU32 cmd)
{
  sDiskItem *di,*dir;
  switch(cmd)
  {
  case sDIC_EXECUTE:
    if(LastSelection)
      LastSelection->Cmd(cmd,0,0);
    return sTRUE;
  case sBLCMD_POPUP:
    if(LastSelection)
      Popup(LastSelection);
    return sTRUE;

  case sBLCMD_PARENT:
    di = Dir->GetParent();
    if(di)
    {
      dir = Dir;
      SetDir(di);
      Select(dir);
    }
    return sTRUE;

  default:
    return sFALSE;
  }
}
Esempio n. 8
0
Wt::WWidget *Navigation::popupMenu()
{
  Wt::WTemplate *result = new TopicTemplate("navigation-popupMenu");

  result->bindWidget("Popup", Popup());

  return result;
}
Esempio n. 9
0
  TopWindowStyle(const WindowStyle other)
    :WindowStyle(other)
#if defined(ENABLE_SDL) && !defined(ANDROID)
    , full_screen(false), resizable(false)
#endif
  {
    Popup();
  }
Esempio n. 10
0
int main(int argc, char* args[]){
  SDLInit();
  SDL_WM_SetCaption("GTG - maps","GTG");

  GTG gtg; gtg.Construct();
  if(!gtg.Load("res")){
    Popup(gtg.GetLastError(),0xFF0000FF,0x000000FF);
  }else{
    int res = gtg.Run();
    if(res < 0){
      Popup(gtg.GetLastError(),0xFF0000FF,0x000000FF);
    }else if(res == 0){
      Popup("Game finished",0x0000FFFF,0xFFFFFFFF);
    }
  }
  gtg.Destruct();

  SDLExit(); return 0;
}
Esempio n. 11
0
  TopWindowStyle()
#if defined(ENABLE_SDL) || defined(USE_X11)
    :full_screen(false)
#endif
#ifdef ENABLE_SDL
    , resizable(false)
#endif
  {
    Popup();
  }
Esempio n. 12
0
// -----------------------------------------------------------------------------
// Called when a key is pressed within the control
// -----------------------------------------------------------------------------
void FlatComboBox::onKeyDown(wxKeyEvent& e)
{
	if (e.GetKeyCode() == WXK_DOWN && !list_down_)
	{
		list_down_ = true;
		Popup();
	}
	else
		e.Skip();
}
Esempio n. 13
0
  TopWindowStyle(const WindowStyle other)
    :WindowStyle(other)
#if defined(ENABLE_SDL) || defined(USE_X11)
    , full_screen(false)
#endif
#ifdef ENABLE_SDL
    , resizable(false)
#endif
  {
    Popup();
  }
Esempio n. 14
0
    void DoShow()
    {
        wxPoint pos = GetTipPoint();

        // We want our anchor point to coincide with this position so offset
        // the position of the top left corner passed to Move() accordingly.
        pos -= m_anchorPos;

        Move(pos, wxSIZE_NO_ADJUSTMENTS);

        Popup();
    }
Esempio n. 15
0
void LauncherForm::onShowHide(QSystemTrayIcon::ActivationReason reason)
{
    if (reason)
    {
        if (reason != QSystemTrayIcon::DoubleClick)
        {
            return;
        }
    }

    Popup();
}
EXPORT_C void CBubbleCtrl::Hide(TBool aFlag)
    {
    if(aFlag) //hide bubble
        {
        Close();            

        }
    else
        {
        Popup(Rect());        
        }
    }
Esempio n. 17
0
File: handler.c Progetto: aosm/X11
/*ARGSUSED*/
void 
PopupSearch(Widget w, XEvent * event, String * params, Cardinal * num_params)
{
  ManpageGlobals * man_globals = GetGlobals(w);

  if (man_globals->search_widget) {
    if (!XtIsRealized(man_globals->search_widget)) {
      XtRealizeWidget(man_globals->search_widget);
      AddCursor(man_globals->search_widget, resources.cursors.search_entry);
    }
    Popup(man_globals->search_widget, XtGrabNone);
  }
}
Esempio n. 18
0
void LauncherForm::checkSharedMemory()
{
    pop_up_needed_.lock();

    bool* is_needed = static_cast<bool*>(pop_up_needed_.data());

    if (*is_needed)
    {
        Popup();
        *is_needed = false;
    }

    pop_up_needed_.unlock();
}
Esempio n. 19
0
void CGeometryView::OnRButtonDown(UINT nFlags, CPoint point) 
{
   if ( nFlags & MK_CONTROL ) 
	  {
        // SetCursor(AfxGetApp()->LoadStandardCursor());   
	    if (!myDegenerateModeIsOn)
	      myView->SetDegenerateModeOn();
	      myView->StartRotation(point.x,point.y);  
	  }
	else // if ( Ctrl )
	  {
	    Popup(point.x,point.y);
      }	
}
Esempio n. 20
0
void atsout(char *pointer)
{
  int i,x, length;
  double aux;

  *ats_tittle=0;
  strcat(ats_tittle,pointer);
  //g_print ("%s\n", pointer);

  if((atsfin=fopen(ats_tittle,"wb"))==0) {
    Popup("Could not open output file for writing");
    return;
  }

  //write header
  fwrite(atshed,1,sizeof(ATS_HEADER),atsfin);
  //write data
  for(i=0; i<(int)atshed->fra; ++i) {
  
    aux=(double)ats_sound->time[0][i];
    fwrite(&aux,1,sizeof(double),atsfin);
 
    for (x=0; x<(int)atshed->par; ++x) {

      aux=(double)ats_sound->amp[x][i]; 
      fwrite(&aux,1,sizeof(double),atsfin); 
      aux=(double)ats_sound->frq[x][i];  
      fwrite(&aux,1,sizeof(double),atsfin); 

      if(FILE_HAS_PHASE) { //read phase data if any...
	aux=(double)ats_sound->pha[x][i]; 
	fwrite(&aux,1,sizeof(double),atsfin);
      }
    }  
    if (FILE_HAS_NOISE) {
      for (x=0; x<ATSA_CRITICAL_BANDS; x++) {//read residual analysis data if any...
	aux=(double)ats_sound->band_energy[x][i];
	fwrite(&aux,1,sizeof(double),atsfin); 
      }
    }
   
  }

  length=my_filelength(atsfin); 
  //g_print ("%d bytes written OK \n", length);
  fclose(atsfin);


  return;
}
Esempio n. 21
0
File: misc.c Progetto: aosm/X11apps
void
PopupWarning(ManpageGlobals * man_globals, char * string)
{
  int n;
  Arg wargs[3];
  Dimension topX, topY;
  char buffer[BUFSIZ];
  Boolean hasPosition;

  snprintf( buffer, sizeof(buffer), "Xman Warning: %s", string);
  hasPosition = FALSE;
  if (top)
  {
    n=0;
    XtSetArg(wargs[n], XtNx, &topX); n++;
    XtSetArg(wargs[n], XtNy, &topY); n++;
    XtGetValues(top, wargs, n);
    hasPosition = TRUE;
  }

  if (man_globals != NULL)
    ChangeLabel(man_globals->label, buffer);
  if (man_globals->label == NULL) {
    n=0;
    if (hasPosition)
    {
      XtSetArg(wargs[n], XtNx, topX); n++;
      XtSetArg(wargs[n], XtNy, topY); n++;
    }
    XtSetArg(wargs[n], XtNtransientFor, top); n++;
    warnShell = XtCreatePopupShell("warnShell", transientShellWidgetClass,
				   initial_widget, wargs, n);
    XtSetArg(wargs[0], XtNlabel, buffer);
    warnDialog = XtCreateManagedWidget("warnDialog", dialogWidgetClass,
				       warnShell, wargs, 1);
    XawDialogAddButton(warnDialog, "dismiss", PopdownWarning,
		       (XtPointer)warnShell);
    XtRealizeWidget(warnShell);
    Popup(warnShell, XtGrabNone);
  }
}
Esempio n. 22
0
void
HelpAgent::display_help (const String locatoridResourceString)
{
  Wait_Cursor bob;

  if (f_helper == NULL)
    create_ui();

  if (f_appXrmDb)
  {
    char* type;
    XrmValue value;

    if(env().debug())
      cerr << "Resource string: " << locatoridResourceString << endl;
    if(XrmGetResource(f_appXrmDb, locatoridResourceString,
                        locatoridResourceString, &type, &value ))
    {
      if(env().debug())
        cerr << "Value: " << value.addr << endl;
      XtVaSetValues(f_helper,
                    DtNhelpType, DtHELP_TYPE_TOPIC,
                    DtNhelpVolume, "Infomgr",
                    DtNlocationId, value.addr,
                    XmNdialogStyle, XmDIALOG_MODELESS,
                    NULL);
      XtManageChild(f_helper);
      Popup();
    }
    else
    {
      message_mgr().error_dialog (UAS_String(
                    CATGETS(Set_Messages, 3, "No help available")));
    }
  }
}
Esempio n. 23
0
void LauncherForm::onProcessEnd(int exitCode, QProcess::ExitStatus status)
{
    Popup();
    ui->connectPushButton->setEnabled(true);
}
Esempio n. 24
0
//---------------------------------------------------------------------------
void __fastcall TTVPMenuContainerForm::DropByKey()
{
	DroppedByKey = true;
	Popup();
}
Esempio n. 25
0
void View::MouseEvent( int what, int x, int y, unsigned int buttons )
{

			// Backwards, as added.
  lock();
  for ( int i = CountChildren() - 1; i >= 0; i-- )  
  {
     View *view = ChildAt(i);

        if ( view->Frame().Contains( x,y ) )
         {
		   int nx = x - view->Frame().left;
		   int ny = y - view->Frame().top;

		   if ( GetWindow() != NULL ) GetWindow()->SetActiveView( view );
		   
		   view->MouseEvent( what, nx, ny, buttons );
		   unlock();
		   return;
	  	 }
  }
  unlock();
 

	// Otherwise...
 
  	   switch( what )
	   {
	     case MOUSE_DOWN:
            MouseDown( x, y, buttons );
		    break;
	     case MOUSE_UP:
			if ( hasFlag( HAS_POPUPMENU ) == false )
			{
			   MouseUp( x, y, buttons );
			   break;
			}
			// Only the right mouse button.
			
			if ( m_buttons != RIGHT_MOUSE_BUTTON )
			{
				MouseUp( x, y, buttons );
				break;
			}

			if ( m_popupMenu == NULL ) m_popupMenu = Popup();
			if ( m_popupMenu == NULL ) return;
			
			m_popupMenu->MoveTo(  x - m_popupMenu->Frame().Width() / 2,
								  y - m_popupMenu->Frame().Height() / 2 );
			
			m_popupMenu->Show();
		    break;

	     case MOUSE_MOVED:
            MouseMoved( x, y, buttons );
		    break;
	   }

	m_buttons = buttons;
}
Esempio n. 26
0
File: undo.c Progetto: bion/ats
void backup_edition(int eddie)
{
  FILE *pundo;
  int i, x;
  short shaux;
  double daux;

  if(undo==FALSE) {return;}
  pundo=fopen(undo_file,"ab");
  if(pundo==0) {
    Popup("Could not open the UNDO backup file: \nUNDO DISABLED");
    undo=FALSE;
    return;
  }
fseek(pundo, 0L, SEEK_END);
//store edition data
 undat=(UNDO_DATA*)realloc(undat,( ned + 1 ) * sizeof(UNDO_DATA));
 
 undat[ned].from=selection.from;
 undat[ned].to  =selection.to;
 undat[ned].f1  =selection.f1;
 undat[ned].f2  =selection.f2;
 undat[ned].ed_kind= eddie;
 undat[ned].nsel  =0;
 //g_print("saving(%d): from=%d to=%d",ned,undat[ned].from,undat[ned].to);
 //write first the selected partials data
 for(i = 0; i < (int)atshed.par; ++i) {
   shaux=selected[i];
   if(selected[i]==TRUE) {
     ++undat[ned].nsel;
   }
   if(fwrite(&shaux,1,sizeof(short),pundo)==FALSE) {
     Popup("Could not write on backup file: \nUNDO DISABLED");
     fclose(pundo);
     undo=FALSE;
     return;
   }
 }
 
 //if changed, write either amplitude or frequency data
 //ONLY selected partials data are written 
   for(i=0; i < aveclen; ++i) {
     
     for(x=0; x < (int)atshed.par; ++x) {
       if (selected[x]==TRUE){ 
	 switch (undat[ned].ed_kind) {
	 case AMP_EDIT:
	   daux=ats_sound->amp[x][selection.from + i];
	   break;
	 case FRE_EDIT:
	   daux=ats_sound->frq[x][selection.from + i];
	   break;
	 }
	 if(fwrite(&daux,1,sizeof(double),pundo)==FALSE) {
	   Popup("Could not write on backup file: \nUNDO DISABLED");
	   fclose(pundo);
	   undo=FALSE;
	   return;
	 }
       }
     }
   }
 

 //
 ++ned;    //update editions counter
 led=ned;  //set the edition level to NED
 fclose(pundo);
 return;
}
Esempio n. 27
0
////////////////////////////////////////////////////////////////////
/////////THIS IS THE MAIN SYNTHESIS LOOP////////////////////////////
////////////////////////////////////////////////////////////////////
void do_synthesis()
{
  int i,x,z,j,maxlen, todo, curr, next, sflag=0;
  float dt=0., rfreq;
  float frame_samps, bw=.1;
  int   ptout;
  float maxamp=0.;
  int   bframe=0, eframe=0;
  int   nValue=0;
  char  stamp[16];
  int   written;
  int   format,header;
  mus_sample_t *obuf[1];
  float cxval, cyval, nxval, nyval, difx, dify;
  TIME_DATA *tdata;
  int nbp;
  float *dospt=NULL, *rospt=NULL;
  RANDI *rarray=NULL;
  float res_band_edges[ATSA_CRITICAL_BANDS+1]=ATSA_CRITICAL_BAND_EDGES;
  float res_band_centers[ATSA_CRITICAL_BANDS];
  char str[100];

  //ATTEMPT TO CATCH TWO POSSIBLE ERRORS........ 
  if(*ats_tittle==0) {
    Popup("ERROR: ATS file undefined,  select it first");
    return; 
  }
  if(*out_tittle==0) {
    Popup("ERROR: Output Soundfile undefined, select it first");  
    return; 
  }  
  if(sparams->amp==0. && sparams->ramp==0.) {
    Popup("ERROR: Deterministic and Residual output set to zero");  
    return; 
  }  


  //OPEN OUTPUT FILE
  set_output_type(&format, &header);

  if((ptout=mus_sound_open_output(out_tittle,(int)sparams->sr,1,format,header,"created by ATSH"))==-1) {
    Popup("ERROR: could not open Output Soundfile for writing");  
    return;
  }

  //do residual data transfer
  if (FILE_HAS_NOISE)
    for(i=0; i<(int)atshed->fra; ++i) band_energy_to_res(ats_sound, i);

  //NOW CHECK WHAT TO DO...
  if(sparams->amp > 0.) sflag |= SYNTH_DET;  //deterministic synthesis only
  if(sparams->ramp > 0.) sflag |= SYNTH_RES; //residual synthesis only

  tl_sr = (float)TABLE_LENGTH / sparams->sr; //needed for ioscilator...
  nbp   = get_nbp(timenv->curve);
  tdata = (TIME_DATA*)malloc(nbp * sizeof(TIME_DATA));
  

  //g_print(" \nNPOINTS= %d \n", nbp); 
  sparams->max_stretch=0.;  
  todo=0;

  //We first must calculate data of each breakpoint
  timenv->dur=fabs(timenv->dur); //correct if negative
  for(i=0; i < nbp - 1; ++i){
    //get the data from the time envelope and convert it to time
    cxval= timenv->dur * (get_x_value(timenv->curve,i)/100.);
    cyval= timenv->ymin + ((timenv->ymax - timenv->ymin) * (get_y_value(timenv->curve,i)/100.));
    nxval= timenv->dur * (get_x_value(timenv->curve,i+1)/100.);
    nyval= timenv->ymin + ((timenv->ymax - timenv->ymin) * (get_y_value(timenv->curve,i+1)/100.));
    
    //diff=0. is a special case we must take in account
    //here all we do is to set it to one millisecond (arbitrarly)
    difx= nxval - cxval;
    if(difx == 0.) difx=.001; 
    dify= nyval - cyval;
    if(dify == 0.) dify=.001; 

    //find out the max. stretching factor(needed to alocate the I/O buffer)
    if(fabs(difx) / fabs(dify) >= sparams->max_stretch) {
      sparams->max_stretch=fabs(difx) / fabs(dify);
    }
    
    //locate the frame for the beggining and end of segments
    if(i == 0){
      if(dify < 0.) bframe= locate_frame((int)atshed->fra-1,cyval, dify);
      else bframe= locate_frame(0,cyval, dify);
    }
    eframe= locate_frame(bframe, nyval, dify);
    //collect the data to be used
    tdata[i].from=bframe;
    tdata[i].to  =eframe;
    tdata[i].size= (int)(abs(eframe - bframe)) + 1;
    tdata[i].tfac=fabs(difx) / fabs(dify);
    todo+=tdata[i].size;
    
    //g_print("\n from frame=%d to frame=%d", bframe,eframe);

    bframe=eframe;
    ////////////////////////////////////////////////////////
    
  }
  

  //INITIALIZE PROGRESSBAR
  strcpy(str,"Writing File " );
  strcat(str, out_tittle);
  StartProgress(str, TRUE);

  //ALLOCATE AND CLEAN AUDIO BUFFERS
  maxlen= (int)ceil(maxtim * sparams->sr * sparams->max_stretch); 
  frbuf = (float *) malloc(maxlen * sizeof(float));
  for(z = 0; z < maxlen; ++z) frbuf[z]=0.;
  obuf[0] = (mus_sample_t *)calloc(maxlen, sizeof(mus_sample_t));

  switch(sflag) { //see which memory resources do we need and allocate them
  case SYNTH_DET: 
    dospt = (float *) malloc( (int)atshed->par * sizeof(float));
    for(z=0; z<(int)atshed->par; ++z) dospt[z]=0.;
    break;
    
  case SYNTH_RES: 
    rospt = (float *) malloc((int)ATSA_CRITICAL_BANDS * sizeof(float)); 
    rarray= (RANDI *) malloc((int)ATSA_CRITICAL_BANDS * sizeof(RANDI));
    for(z=0; z<(int)ATSA_CRITICAL_BANDS; ++z) {
      res_band_centers[z]= res_band_edges[z]+((res_band_edges[z+1]-res_band_edges[z])*0.5); 
      randi_setup(sparams->sr,res_band_edges[z+1]-res_band_edges[z],&rarray[z]);
      rospt[z]=0.;
    }
    break;

  case SYNTH_BOTH: 
    dospt = (float *) malloc( (int)atshed->par * sizeof(float));
    rarray= (RANDI *) malloc( (int)atshed->par * sizeof(RANDI));
    for(z=0; z<(int)atshed->par; ++z) {
      rfreq=(ats_sound->frq[z][tdata[0].from] < 500.? 50. : ats_sound->frq[z][tdata[0].from] * bw);
      randi_setup(sparams->sr,rfreq,&rarray[z]);
      dospt[z]=0.;
    }
    break;  

  }
  //NOW DO IT...
  written=0;
  stopper=FALSE;

  for(i = 0; i < nbp - 1; i++) { 

    curr=tdata[i].from;
 
    for(j=0; j < tdata[i].size;   j++) {

      next=(tdata[i].from < tdata[i].to ? curr+1 : curr-1 );	        
      if(next < 0 || next >= (int)atshed->fra) break;

      dt=fabs(ats_sound->time[0][next] - ats_sound->time[0][curr]);
      frame_samps=dt * sparams->sr * tdata[i].tfac ;      

      switch (sflag) {
      case SYNTH_DET: { //deterministic synthesis only
	for(x = 0; x < (int)atshed->par; x++) {                       
	  synth_deterministic_only(ats_sound->amp[x][curr], 
				   ats_sound->amp[x][next], 
				   ats_sound->frq[x][curr] * sparams->frec,
				   ats_sound->frq[x][next] * sparams->frec, 
				   frame_samps,x, dospt);     	  	         
	}
	break;
      }	
      case SYNTH_RES: { //residual synthesis only
	for(x = 0; x < (int)ATSA_CRITICAL_BANDS; x++) {
	  synth_residual_only(ENG_RMS(ats_sound->band_energy[x][curr], atshed->ws), 
			      ENG_RMS(ats_sound->band_energy[x][next],atshed->ws) ,
			      res_band_centers[x],frame_samps,x,rospt,&rarray[x]);  
	}
	break;
      }
      case SYNTH_BOTH: { //residual and deterministic synthesis  
	for(x = 0; x < (int)atshed->par; x++) {
	  rfreq=(ats_sound->frq[x][curr] < 500.? 50. : ats_sound->frq[x][curr]* bw);
	  synth_both(ats_sound->amp[x][curr], 
		     ats_sound->amp[x][next], 
		     ats_sound->frq[x][curr] * sparams->frec,
		     ats_sound->frq[x][next] * sparams->frec, 
		     frame_samps,x, dospt,
		     ENG_RMS(ats_sound->res[x][curr] * sparams->ramp, atshed->ws), 
		     ENG_RMS(ats_sound->res[x][next] * sparams->ramp, atshed->ws),
		     &rarray[x]);     	  	         
	}
	break;
	
      }
      }//end switch
      
      for(z=0; z< maxlen; ++z) {      //write and clean output buffer     
	if(z < (int)frame_samps) {      
	  
	  obuf[0][z] = MUS_FLOAT_TO_SAMPLE(frbuf[z]);	  
	  written++;
	  if (fabs(frbuf[z]) >= maxamp) {maxamp=fabs(frbuf[z]);}
	}
	frbuf[z]=0.;   
      }
      mus_sound_write(ptout, 0, frame_samps-1, 1, obuf);
      if(stopper==TRUE) goto finish;
      ++nValue;
      UpdateProgress(nValue,todo);
      curr=(tdata[i].from < tdata[i].to ? curr+1 :curr-1  );
    }
    
  } //CHANGE BREAKPOINT
  
 finish:

  free(frbuf);
  
  switch (sflag) {
  case SYNTH_DET:
    free(dospt);
    break;
  case SYNTH_RES: 
    free(rospt);
    free(rarray);
    break;
  case SYNTH_BOTH: 
    free(dospt);
    free(rarray);
    break;
  }
  
  mus_sound_close_output(ptout,written * mus_data_format_to_bytes_per_sample(format));

//   *info=0;
//   strcat(info, "DONE OK...!!! MAXAMP= ");
//   sprintf(stamp,"%6.4f ",maxamp);
//   strcat(info, stamp);
//   Popup(info);

  free(obuf[0]);
  free(tdata);
  EndProgress();

  strcpy(str, "DONE! MAXAMP= ");
  sprintf(stamp, "%6.4f", maxamp);
  strcat(str, stamp);
  Popup(str);

}
Esempio n. 28
0
File: undo.c Progetto: bion/ats
void do_undo(GtkWidget *widget,gpointer data)
{
  int aflag;
  FILE *pundo;
  int seek_point=0; 
  int i,x;
  short shaux;
  double daux;

  if(undo==FALSE) {return;}
  if(floaded==FALSE || ned == 0) {return;} 

  aflag=GPOINTER_TO_INT(data); 
  led +=aflag;
  if(led < 0) {led=0; ned=1;}
  if(led == ned) {led=ned-1;} 

  if((pundo=fopen(undo_file,"rb"))==NULL) {
    Popup("Could not open the UNDO backup file: /nUNDO DISABLED");
    undo=FALSE;
    return;
  }
  fseek(pundo, (long int)seek_point, SEEK_SET); 
  //find out where data starts and store it in seek_point
  
  for(i=0; i < led; ++i){
    seek_point += (int)(atshed.par * sizeof(short));
    seek_point += (int)((undat[i].to - undat[i].from) + 1 ) * sizeof(double) * undat[i].nsel;
  }

  //go in seek_point bytes 
  fseek(pundo, (long int)seek_point, SEEK_SET);
  //read the backup data
  for(i=0; i < (int)atshed.par; ++i) {
    if(fread(&shaux,1,sizeof(short),pundo)==0) {
      Popup("Could not read on backup file: \nUNDO DISABLED");
      fclose(pundo);
      undo=FALSE;
      return;
    }
    selected[i]=shaux;
    //g_print(" %d ", selected[i]);
  }
  //g_print("retrieving(%d): from=%d to=%d \n",ned,undat[led].from,undat[led].to);
  
    for(i=undat[led].from; i < undat[led].to+1; ++i) { 
    
      for(x = 0; x < (int)atshed.par; ++x) {
	if(selected[x]==TRUE) {
	  if(fread(&daux,1,sizeof(double),pundo)==0) {
	    Popup("Could not read on backup file:(2) \nUNDO DISABLED");
	    //g_print("\n led= %d ned=%d \n", led, ned);
	    fclose(pundo);
	    undo=FALSE;
	    return;
	  }
	  switch (undat[led].ed_kind) {
	  case AMP_EDIT:
	    ats_sound->amp[x][i]=daux;
	    break;
	  case FRE_EDIT:
	    ats_sound->frq[x][i]=daux;
	    break;
	  }
	}
      }
    }    
 
 
 selection.from=undat[led].from;
 selection.to=undat[led].to;
 selection.f1=undat[led].f1;
 selection.f2=undat[led].f2;
 vertex1=FALSE; vertex2=TRUE; //something IS selected  
 // set_avec(selection.to - selection.from);
 fclose(pundo);
 if(scale_type==SMR_SCALE) { //smr values are computed only if the user is viewing them
   atsh_compute_SMR(ats_sound,selection.from,selection.to);
 }
 else {
   smr_done=FALSE;
 }
 draw_pixm(); 
 // repaint();

 // return;
}
Esempio n. 29
0
 void DoShow()
 {
     Popup();
 }
Esempio n. 30
0
//---------------------------------------------------------------------------
void __fastcall TTVPMenuContainerForm::Drop()
{
	DroppedByKey = false;
	LastOutOfWindow = false;
	Popup();
}