示例#1
0
void Card::setAll(const char* allch) {
		String all = allch;
		int indexof = all.find(delim);
		if (indexof > -1) {
			setQuantity(all.substr(0,indexof++).c_str());
			all=all.substr(indexof);
			indexof = all.find(delim);
			setText(all.substr(0,indexof++).c_str());
			all=all.substr(indexof);
			indexof = all.find(delim);
			setThumb(all.substr(0,indexof++).c_str());
			all=all.substr(indexof);
			indexof = all.find(delim);
			setFront(all.substr(0,indexof++).c_str());
			all=all.substr(indexof);
			indexof = all.find(delim);
			setBack(all.substr(0,indexof++).c_str());
			all=all.substr(indexof);
			indexof = all.find(delim);
			setId(all.substr(0,indexof++).c_str());
			all=all.substr(indexof);
			indexof = all.find(delim);
			setRate(all.substr(0,indexof++).c_str());
			all=all.substr(indexof);
			indexof = all.find(delim);
			setValue(all.substr(0,indexof++).c_str());
			all=all.substr(indexof);
			indexof = all.find(delim);
			setNote(all.substr(0,indexof++).c_str());
			all=all.substr(indexof);

			setLoaded(true);
			if ((getText().length() <= 0)||(getQuantity().length() <= 0)) {
				setQuantity("");
				setText("");
				setLoaded(false);
			}
		} else {
			setQuantity("");
			setText("");
			setThumb("");
			setFront("");
			setBack("");
			setId("");
			setRate("");
			setValue("");
			setNote("");
			setLoaded(false);
		}
}
示例#2
0
// does the work for the keychange
void keyChange(std::istream& input)
{
   //input.get(); // forward 1;
   while(input)
   {
      char note;
      input >> note;// = input.get();
      if(!input)
         break;
      const char nextChar = input.get();
//      input >> nextChar;// = input.get();
      if (nextChar == 'b') // flatten
      {
         setNote(note, FLAT);
         //input.get(); // forward 1 to skip space
         continue;
      }
      else if(nextChar == '#') // sharpen
      {
         setNote(note, SHARP);
         //input.get(); // forward 1 to skip space
         continue;
      }
      // now nextChar can only equal space
      else if (!std::isspace(nextChar))
      {
         std::cout << "Unrecognised character of '" << nextChar << "' in keychage.\n";
         return;
      }
      const char thirdChar = input.peek();
      if (std::isdigit(thirdChar)) // a pitch is being set
      {
         double newFreq;
         input >> newFreq;
         if(input.fail())
         {
            std::cout << "Failed to read frequency in keychange.\n";
            return;
         }
         //input.get(); // forward 1
         setNote(note,newFreq);
      }
      else // must be reseting to natural
      {
         setNote(note,NATURAL);
         continue;
      }
   }
void Speaker::playNote(uint8_t n,uint16_t dur){
	setNote(n);
	turnOn();
	DelayLoop(dur);
	turnOff();
	DelayLoop(5);
}
示例#4
0
TmultiScore::TmultiScore(QMainWindow* mw, QWidget* parent) :
  TsimpleScore(1, parent),
  m_mainWindow(mw),
  m_inMode(e_multi),
  m_scale(1.0),
  m_clickedOff(0), m_currentIndex(-1),
  m_useAinim(true),
  m_addNoteAnim(true),
  m_selectReadOnly(false), m_isDisabled(false)
{
  setObjectName(QStringLiteral("m_mainScore"));
  setStyleSheet(QStringLiteral("TsimpleScore#m_mainScore { background: transparent }"));
  setContentsMargins(2, 2, 2, 2);
  if (!TscoreNote::touchEnabled())
    setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); // it is off by default
  staff()->setZValue(11); // to be above next staves - TnoteControl requires it
  setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

  setMaximumWidth(QWIDGETSIZE_MAX); // revert what TsimpleScore 'broke'
  setAlignment(Qt::AlignCenter);

  if (qApp->applicationName() == QLatin1String("Scorek")) {
    addStaff(staff()); // TODO: main score does that - but TmultiScore is dependent on it then - try to move it here
    setNote(0, Tnote()); // To display fake empty note properly
  }

}
SettingsNoteDialog::SettingsNoteDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::SettingsNoteDialog)
{
    ui->setupUi(this);
    ui->opacity->setRange( nm_Note::minimalOpacity * 100, nm_Note::maximalOpacity * 100 );

    setNote(0);
}
示例#6
0
void TmultiScore::removeCurrentNote() {
  if (currentIndex() > 0 || (currentIndex() == 0 && staff()->count() > 1))
    currentStaff()->removeNote(currentIndex() % staff()->maxNoteCount());
  else if (currentIndex() == 0) { // just clear first note when only one
    m_clickedOff = 0;
    setNote(Tnote());
    m_clickedOff = 0; // in record mode this is increased after setNote()
    emit noteWasChanged(0, Tnote());
  }
  staff()->noteSegment(0)->hideWorkNote();
}
示例#7
0
void YMVoice::reset()
{
  //set frequency to no freq
  setNote(128,true);   

  //set volume to zero and envelope mode off
  YM_REG_LEVEL.EMPTY = 0;  
  YM_REG_LEVEL.MODE = 0;  
  YM_REG_LEVEL.LEVEL = 0;   
  YM2149REG(YM_ADDR_LEVEL) = *(char*)&YM_REG_LEVEL;
}
示例#8
0
文件: osc.cpp 项目: eriser/audio-1
void Oscillator::reset() {
	
	parameters.amp = 0.5f;
	parameters.wave = OSC_SAWTOOTH;
	counter = 0.0f;
	sqp = 1.0f;
	sqc = 0;
	parameters.pulsewidth = 0.0f;
	parameters.detune = 0;
	setAmp(1.0f);
	setWave(OSC_SAWTOOTH);
	setPulseWidth(0.0f);
	setNote(12);
	setDetune(0);
}
示例#9
0
bool NoteDialog::save()
{
    if (m_noteEdit->hasChanged())
    {
        // Si c'est un ajout
        if (m_note == 0)
        {
            // Création de la note
            Note *note = new Note(title(), content());
            note->addToDb();
            setNote(note);

            // Ajout de la note dans la liste
            emit newNote(note);
        }

        // Modification
        else
        {
            // Mise à jour de la note elle-même
            m_note->setTitle(title());
            m_note->setContent(content());
            m_note->setToSync(true);
            m_note->editInDb();

            // Mise à jour de la note dans la liste
            m_note->item()->update();

            // Si la note est dans le panneau, on le met à jour
            if (m_note->notePanel())
            {
                m_note->notePanel()->update();
            }
        }

        // Mise à jour du titre (après génération automatique)
        m_noteEdit->setTitle(m_note->title());
        setWindowTitle(m_note->title());

        // Enregistrement terminée, il n'y a donc plus de changements en attente
        m_noteEdit->setNoChange();
        return true;
    }
    return false;
}
示例#10
0
void TmultiScore::setInsertMode(TmultiScore::EinMode mode) {
  if (mode != m_inMode) {
    bool ignoreThat = false;
    if ((mode == e_record && m_inMode == e_multi) || (mode == e_multi && m_inMode == e_record))
      ignoreThat = true;
    m_inMode = mode;
    if (ignoreThat)
      return;
    if (mode == e_single) {
        scoreScene()->left()->enableToAddNotes(false); // It has to be invoked before deleteNotes() to hide 'enter note' text
        scoreScene()->right()->enableToAddNotes(false);
        deleteNotes();
        staff()->noteSegment(0)->setBackgroundColor(-1); // unset background
        staff()->setStafNumber(-1);
        staff()->setViewWidth(0.0);
        staff()->setSelectableNotes(false);
        m_addNoteAnim = false;
        staff()->insertNote(1, true);
        m_addNoteAnim = false;
        staff()->insertNote(2, true);
        setControllersEnabled(true, false);
        setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
        m_currentIndex = 0;
        m_selectReadOnly = false;
        if (!m_fakeLines.isEmpty()) {
          for (int i = 0 ; i < m_fakeLines.size(); ++i)
            delete m_fakeLines[i];
          m_fakeLines.clear();
        }
    } else {
        staff()->setStafNumber(0);
        staff()->removeNote(2);
        staff()->removeNote(1);
        staff()->setSelectableNotes(true);
        setControllersEnabled(true, true);
        scoreScene()->left()->enableToAddNotes(true);
        scoreScene()->right()->enableToAddNotes(true);
        setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
        setMaximumWidth(QWIDGETSIZE_MAX); // revert what TsimpleScore 'broke'
        setNote(0, Tnote());
    }
    resizeEvent(0);
  }
}
示例#11
0
int View::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = BaseView::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: setCandidateMove((*reinterpret_cast< const Quackle::Move(*)>(_a[1]))); break;
        case 1: removeCandidateMoves((*reinterpret_cast< const Quackle::MoveList(*)>(_a[1]))); break;
        case 2: commit(); break;
        case 3: setRack((*reinterpret_cast< const Quackle::Rack(*)>(_a[1]))); break;
        case 4: setNote((*reinterpret_cast< const UVString(*)>(_a[1]))); break;
        case 5: positionChanged((*reinterpret_cast< const Quackle::GamePosition(*)>(_a[1]))); break;
        case 6: movesChanged((*reinterpret_cast< const Quackle::MoveList(*)>(_a[1]))); break;
        case 7: grabFocus(); break;
        }
        _id -= 8;
    }
    return _id;
}
示例#12
0
	void edit(int x, const QString &i, const QString &b, const QString &o, const QString &n){
		qDebug() << "ACM::edit";
		auto a = _accounts[x];
		a->setIban(i); a->setBic(b); a->setOwner(o); a->setNote(n);
		emit dataChanged(createIndex(x,0),createIndex(x,3));
	}
void AbstractParser::parseNoteCmd(StringView view)
{
    setNote(view.toQString());
}
示例#14
0
文件: osc.cpp 项目: eriser/audio-1
void Oscillator::setDetune(long detune) {
	
	parameters.detune = detune;
	setNote(note);
}
示例#15
0
void FreqControl::setOctave (Octave oct)
{
    mCurrentOctave = oct;
    setNote(mOriginalMidiNote);
}
示例#16
0
bool CUserItem::setFromString( wxString userSettings )
{
    wxString strToken;
    wxStringTokenizer tkz( userSettings, _(";") ); 
    
    // name
    if ( tkz.HasMoreTokens() ) {
        strToken = tkz.GetNextToken();
        strToken.Trim();
        strToken.Trim(false);
        if ( strToken.Length() ) {
            setUser( strToken );
            fixName();
        }
    }
    
    // password
    if ( tkz.HasMoreTokens() ) {
        strToken = tkz.GetNextToken();
        strToken.Trim();
        strToken.Trim(false);
        if ( strToken.Length() ) {
            setPassword( strToken );
        }
    }
    
    // fullname
    if ( tkz.HasMoreTokens() ) {
        strToken = tkz.GetNextToken();
        strToken.Trim();
        strToken.Trim(false);
        if ( strToken.Length() ) {
            setFullname( strToken );
        }
    }
    
    // filter
    if ( tkz.HasMoreTokens() ) {
        strToken = tkz.GetNextToken();
        strToken.Trim();
        strToken.Trim(false);
        if ( strToken.Length() ) {
            setFilterFromString( strToken );
        }
    }
    
    // mask
    if ( tkz.HasMoreTokens() ) {
        strToken = tkz.GetNextToken();
        setFilterFromString( strToken );
    }
    
    // rights
    if ( tkz.HasMoreTokens() ) {
        strToken = tkz.GetNextToken();
        strToken.Trim();
        strToken.Trim(false);
        if ( strToken.Length() ) {
            setUserRightsFromString( strToken );
        }
    }
        
    // remotes
    if ( tkz.HasMoreTokens() ) {
        strToken = tkz.GetNextToken();
        setAllowedRemotesFromString( strToken );
    }
    
    // events
    if ( tkz.HasMoreTokens() ) {
        strToken = tkz.GetNextToken();
        strToken.Trim();
        strToken.Trim(false);
        if ( strToken.Length() ) {
            setAllowedEventsFromString( strToken );
        }
    }    
    
    // note
    if ( tkz.HasMoreTokens() ) {
        strToken = tkz.GetNextToken();        
        strToken.Trim();
        strToken.Trim(false);
        if ( strToken.Length() ) {
            size_t len = wxBase64Decode( NULL, 0, strToken );
            if ( 0 == len ) return false;
            uint8_t *pbuf = new uint8_t[len];
            if ( NULL == pbuf ) return false;
            len = wxBase64Decode( pbuf, len, strToken );
            strToken = wxString::FromUTF8( (const char *)pbuf, len );
            delete [] pbuf;        
        
            setNote( strToken );
        }
    }
    
    return true;
}
示例#17
0
void TrashItem::setNote(Note note) {
    setNote(&note);
}
示例#18
0
void Card::setAll(const char* allch) {
		String all = allch;
		int indexof = all.find(",");
		if (indexof > -1) {
			setQuantity(all.substr(0,indexof++).c_str());
			all=all.substr(indexof);
			indexof = all.find(",");
			setText(all.substr(0,indexof++).c_str());
			all=all.substr(indexof);
			indexof = all.find(",");
			setThumb(all.substr(0,indexof++).c_str());
			all=all.substr(indexof);
			indexof = all.find(",");
			setFront(all.substr(0,indexof++).c_str());
			all=all.substr(indexof);
			indexof = all.find(",");
			setBack(all.substr(0,indexof++).c_str());
			all=all.substr(indexof);
			indexof = all.find(",");
			setId(all.substr(0,indexof++).c_str());
			all=all.substr(indexof);
			indexof = all.find(",");
			setRate(all.substr(0,indexof++).c_str());
			all=all.substr(indexof);
			indexof = all.find(",");
			setValue(all.substr(0,indexof++).c_str());
			all=all.substr(indexof);
			indexof = all.find(",");
			setNote(all.substr(0,indexof++).c_str());
			all=all.substr(indexof);
			indexof = all.find(",");
			setOrientation(all.substr(0,indexof++).c_str());
			all=all.substr(indexof);

			Stat *newStat;
			while (all.length() > 1) {
				indexof = all.find("$");
				newStat = new Stat();
				newStat->setAll(all.substr(0,indexof++).c_str());
				stats.add(newStat);
				all=all.substr(indexof);
			}

			setLoaded(true);
			if ((getText().length() <= 0)||(getQuantity().length() <= 0)) {
				setQuantity("");
				setText("");
				setLoaded(false);
			}
		} else {
			setQuantity("");
			setText("");
			setThumb("");
			setFront("");
			setBack("");
			setId("");
			setRate("");
			setValue("");
			setNote("");
			setOrientation("");
			setLoaded(false);
		}
}