Exemple #1
0
void IPlugVST3::InformHostOfParamChange(int idx, double normalizedValue)
{ 
  if (GetParam(idx)->GetCanAutomate()) 
  {
    performEdit(idx, normalizedValue);
  }
}
Exemple #2
0
/*Main method for audioedit.*/
int main(int argc, char *argv[])
{
  int i = 1;
  
  Edit edit = {0};
  Audio audio = {0};
  
  if(argc <= 1)
  {
    printf("%s: missing operand\nTry '%s -help' for more information.\n", argv[0], argv[0]);
    return 0;
  }

  /*Getting command line data.*/
  for(; i < argc; i++)
  {
    if(!strcmp(argv[i], "-help"))
    {
      printf("NAME\n   %s - command line program for editing WAVE audio files.\n", argv[0]);
      printf("\nSYNOPSIS\n   %s -help\n   %s -version\n", argv[0], argv[0]);
      printf("   %s [-tb n] [-te m] [-r] [-a f] -i inputfile.wav -o outputfile.wav\n", argv[0]);
      printf("\nDESCRIPTION\n");
      printf("   This program enables the basic audio editing of restricted canonical wave audio files.\n");
      printf("\nOPTIONS\n");
      printf("    -help     display the command line options\n");
      printf("    -version  display the version number\n");
      printf("    -r        reverses the audio clip\n");
      printf("    -a f      amplifies the audio clip by the given float factor f\n");
      printf("    -tb n     trim n samples from the beginning of the audio clip\n");
      printf("    -te m     trim m samples off the end of the audio clip\n");
      printf("    -i file   provide the input file name\n");
      printf("    -o file   provide the output file name (overwriting an existing file)\n");
      return 0;
    }
    else if(!strcmp(argv[i], "-version"))
    {
      printf("%s v%s\n%s\n%s\n", argv[0], VERSION, AUTHOR, PURPOSE);
      return 0;
    }
    else if(!strcmp(argv[i], "-r")) edit.reverse = 1;
    else if(i + 1 < argc)
    {
      if(!strcmp(argv[i], "-i")) audio.input = argv[++i];
      else if(!strcmp(argv[i], "-o")) edit.output = argv[++i];
      else if(!strcmp(argv[i], "-tb")) edit.tb = atoi(argv[++i]);
      else if(!strcmp(argv[i], "-te")) edit.te = atoi(argv[++i]);
      else if(!strcmp(argv[i], "-a")) edit.amplification = atof(argv[++i]);
    }
    else
    {
      printf("Unknown option '%s'. Try '%s -help' for more information.\n", argv[i], argv[0]);
      return 0;
    }
  }
  
  if(!audio.input)
  {  
    printf("Please specify an input file. Try '%s -help' for more information.\n", argv[0]);
    return 0;
  }

  performEdit(&audio, &edit);

  return 0;
}
void IPlugVST3Plugin::InformHostOfParamChange(int idx, double normalizedValue)
{
  Trace(TRACELOC, "%d:%f", idx, normalizedValue);
  performEdit(idx, normalizedValue);
}
Exemple #4
0
/*
 * This function injects a single character into the widget.
 */
static int _injectCDKUScale (CDKOBJS *object, chtype input)
{
    CDKUSCALE *widget = (CDKUSCALE *)object;
    int ppReturn = 1;
    unsigned ret = unknownUnsigned;
    bool complete = FALSE;

    /* Set the exit type. */
    setExitType(widget, 0);

    /* Draw the field. */
    drawCDKUScaleField (widget);

    /* Check if there is a pre-process function to be called. */
    if (PreProcessFuncOf(widget) != 0)
    {
        /* Call the pre-process function. */
        ppReturn = PreProcessFuncOf(widget) (vUSCALE, widget, PreProcessDataOf(widget), input);
    }

    /* Should we continue? */
    if (ppReturn != 0)
    {
        /* Check for a key binding. */
        if (checkCDKObjectBind(vUSCALE, widget, input) != 0)
        {
            checkEarlyExit(widget);
            complete = TRUE;
        }
        else
        {
            switch (input)
            {
            case KEY_LEFT :
                setEditPosition(widget, widget->fieldEdit + 1);
                break;

            case KEY_RIGHT :
                setEditPosition(widget, widget->fieldEdit - 1);
                break;

            case KEY_DOWN :
                Decrement(widget->current, widget->inc);
                break;

            case KEY_UP :
                Increment(widget->current, widget->inc);
                break;

            case KEY_PPAGE :
                Increment(widget->current, widget->fastinc);
                break;

            case KEY_NPAGE :
                Decrement(widget->current, widget->fastinc);
                break;

            case KEY_HOME :
                widget->current = widget->low;
                break;

            case KEY_END :
                widget->current = widget->high;
                break;

            case KEY_TAB :
            case KEY_ENTER :
                setExitType(widget, input);
                ret = (widget->current);
                complete = TRUE;
                break;

            case KEY_ESC :
                setExitType(widget, input);
                complete = TRUE;
                break;

            case CDK_REFRESH :
                eraseCDKScreen (ScreenOf(widget));
                refreshCDKScreen (ScreenOf(widget));
                break;

            default :
                if (widget->fieldEdit)
                {
                    if (!performEdit(widget, input))
                        BEEP();
                }
                else
                {
                    /*
                     * The cursor is not within the editable text.  Interpret
                     * input as commands.
                     */
                    switch (input)
                    {
                    case 'd':
                    case '-':
                        return _injectCDKUScale(object, KEY_DOWN);
                    case '+':
                        return _injectCDKUScale(object, KEY_UP);
                    case 'D':
                        return _injectCDKUScale(object, KEY_NPAGE);
                    case '0':
                        return _injectCDKUScale(object, KEY_HOME);
                    default:
                        BEEP();
                        break;
                    }
                }
                break;
            }
        }
        limitCurrentValue(widget);

        /* Should we call a post-process? */
        if (!complete && (PostProcessFuncOf(widget) != 0))
        {
            PostProcessFuncOf(widget) (vUSCALE, widget, PostProcessDataOf(widget), input);
        }
    }

    if (!complete) {
        drawCDKUScaleField (widget);
        setExitType(widget, 0);
    }

    ResultOf(widget).valueUnsigned = ret;
    return (ret != unknownUnsigned);
}