Exemplo n.º 1
0
bool Ambitus::setProperty(Pid propertyId, const QVariant& v)
      {
      switch (propertyId) {
            case Pid::HEAD_GROUP:
                  setNoteHeadGroup( NoteHead::Group(v.toInt()) );
                  break;
            case Pid::HEAD_TYPE:
                  setNoteHeadType( NoteHead::Type(v.toInt()) );
                  break;
            case Pid::MIRROR_HEAD:
                  setDirection(MScore::DirectionH(v.toInt()) );
                  break;
            case Pid::GHOST:                 // recycled property = _hasLine
                  setHasLine(v.toBool());
                  break;
            case Pid::LINE_WIDTH:
                  setLineWidth(v.value<Spatium>());
                  break;
            case Pid::TPC1:
                  setTopTpc(v.toInt());
                  break;
            case Pid::FBPARENTHESIS1:        // recycled property = _bottomTpc
                  setBottomTpc(v.toInt());
                  break;
            case Pid::PITCH:
                  setTopPitch(v.toInt());
                  break;
            case Pid::FBPARENTHESIS2:        // recycled property = _bottomPitch
                  setBottomPitch(v.toInt());
                  break;
            case Pid::FBPARENTHESIS3:        // recycled property = octave of _topPitch
                  setTopPitch(topPitch() % 12 + v.toInt() * 12);
                  break;
            case Pid::FBPARENTHESIS4:        // recycled property = octave of _bottomPitch
                  setBottomPitch(bottomPitch() % 12 + v.toInt() * 12);
                  break;
            default:
                  return Element::setProperty(propertyId, v);
            }
      triggerLayout();
      return true;
      }
Exemplo n.º 2
0
GData::GData(/*int buffer_size_, int winfunc_, float step_size_*/)
{
  _polish = true;
  _drawingBuffer = new QPixmap(1, 1);
  setDBFloor(-150.0);
  setTopPitch(128.0);
  setLeftTime(0.0);
  setRightTime(5.0);

  amp_thresholds[AMPLITUDE_RMS][0]           = -85.0; amp_thresholds[AMPLITUDE_RMS][1]           = -0.0;
  amp_thresholds[AMPLITUDE_MAX_INTENSITY][0] = -30.0; amp_thresholds[AMPLITUDE_MAX_INTENSITY][1] = -20.0;
  amp_thresholds[AMPLITUDE_CORRELATION][0]   =  0.40; amp_thresholds[AMPLITUDE_CORRELATION][1]   =  1.00;
  amp_thresholds[FREQ_CHANGENESS][0]         =  0.50; amp_thresholds[FREQ_CHANGENESS][1]         =  0.02;
  amp_thresholds[DELTA_FREQ_CENTROID][0]     =  0.00; amp_thresholds[DELTA_FREQ_CENTROID][1]     =  0.10;
  amp_thresholds[NOTE_SCORE][0]              =  0.03; amp_thresholds[NOTE_SCORE][1]              =  0.20;
  amp_thresholds[NOTE_CHANGE_SCORE][0]       =  0.12; amp_thresholds[NOTE_CHANGE_SCORE][1]       =  0.30;

  amp_weights[0] = 0.2;
  amp_weights[1] = 0.2;
  amp_weights[2] = 0.2;
  amp_weights[3] = 0.2;
  amp_weights[4] = 0.2;
  //setNoiseThresholdDB(-100.0);
  //setChangenessThreshold(0.8); //1.8);

  //settings.init("cs.otago.ac.nz", "Tartini");
  qsettings = new QSettings("cs.otago.ac.nz", TARTINI_NAME_STR);
  TartiniSettingsDialog::setUnknownsToDefault(qsettings);
  //settings.print();
  //settings.load();
  //settings.print();
  
  activeChannel = NULL;
  _doingActiveAnalysis = 0;
  _doingActiveFFT = 0;
  _amplitudeMode = 0;
  _pitchContourMode = 0;
  _analysisType = 0;
  _doingActiveCepstrum = 0;

  updateQuickRefSettings();
  
    //char *filename = getenv("PITCH_INI");
    //if(filename == NULL) {
	//filename = "pitch.ini";
    //}
    //settings.load(filename);

    //buffer_size = buffer_size_;
    //winfunc = winfunc_;
    //step_size = step_size_;
    
    peakThreshold = -60.0; //in dB
    correlationThreshold = 0.00001f; //0.5 in the other scale (log);
    frameCounter = 0;
    //equalLoudness = false; //true;
    //useMasking = false; //true;
    //harmonicNum = 1;

    //useRidgeFile = false; /**< Store harmonic info to a ridge file */
    
    doingStuff = false; /**< Active/inactive */
    running = STREAM_STOP;
    
    //in_channels = 2;
    //process_channels = 1;
    //out_channels = 2;
    interpolating_type = 2; //HERMITE_CUBIC;
    //bisection_steps = settings.get_int("Correlation", "bisectionSteps", 8); //8;
    //fast_correlation_repeats = settings.get_int("Correlation", "fastRepeats", 512);
    using_coefficients_table = true;

    audio_stream = NULL;
    soundMode = SOUND_PLAY;

#if 0 //dont use chirp stuff
    //setup fct
    fct.set_N_dimensions(2);
    fct.set_N_data(buffer_size);
    fct.set_phase_function(1,64,&phase_function);
    fct.set_N_tau0(buffer_size);
    fct.initialize();
    //Allocate fct memory
    fct_in_data  = (float *)calloc(2*buffer_size, sizeof(float));
    fct_out_data = (float *)calloc(2*fct.get_output_data_length(), sizeof(float));
    fct_draw_data = (FrameRGB *)calloc(buffer_size/2*64, sizeof(FrameRGB));
#endif

    cur_note = 0.0;

    sync_flag = 0;
    need_update = false;

    //view = new View();
    
    //lineColor.push_back(Qt::white);
    //lineColor.push_back(Qt::black);
    //lineColor.push_back(Qt::red);
    lineColor.push_back(Qt::darkRed);
    //lineColor.push_back(Qt::green);
    lineColor.push_back(Qt::darkGreen);
    //lineColor.push_back(Qt::blue);
    lineColor.push_back(Qt::darkBlue);
    //lineColor.push_back(Qt::cyan);
    lineColor.push_back(Qt::darkCyan);
    //lineColor.push_back(Qt::magenta);
    lineColor.push_back(Qt::darkMagenta);
    //lineColor.push_back(Qt::yellow);
    lineColor.push_back(Qt::darkYellow);
    //lineColor.push_back(Qt::gray);
    lineColor.push_back(Qt::darkGray);
    //lineColor.push_back(Qt::lightGray);

    nextColorIndex = 0;

  //_musicKey = 2; //C
  _musicKeyType = 0; //ALL_NOTES
  _temperedType = 0; //EVEN_TEMPERED
  initMusicStuff();
}