Beispiel #1
0
const char *get_next_tlp_command(const char *codebuf) {
    const char *codebuf_end = NULL;
    if (codebuf == NULL) {
        return NULL;
    }
    codebuf_end = codebuf + strlen(codebuf);
    if (codebuf == codebuf_end) {
        return NULL;
    }
    while (codebuf != codebuf_end && !is_note(*codebuf)                   &&
                                     !is_technique_tag_announce(*codebuf) &&
                                     !is_note_sep(*codebuf)               &&
                                     !is_sep_bar(*codebuf)                &&
                                     !is_save_point(*codebuf)             &&
                                     !is_technique_block_end(*codebuf)    &&
                                     !is_oncemore(*codebuf)) {
        if (is_comment(*codebuf)) {
            while (codebuf != codebuf_end && *codebuf != '\n') {
                codebuf++;
            }
            if (codebuf == codebuf_end) {
                continue;
            }
        }
        if (*codebuf == '\n') {
            g_curr_line_nr++;
        }
        codebuf++;
    }
    return codebuf;
}
Beispiel #2
0
static void stop_note2(Data *data, int time, note_t note){
  Voice *voice = data->voices_playing;
  while(voice!=NULL){
    if(is_note(note, voice->note_id, voice->seqblock))
      voice->delta_pos_at_end = time;
    voice=voice->next;
  }
}
Beispiel #3
0
static void set_note_pitch2(Data *data, int time, note_t note){
  Voice *voice = data->voices_playing;
  //printf("Setting volume %f / %f\n",volume,velocity2gain(volume));
  while(voice!=NULL){
    if(is_note(note, voice->note_id, voice->seqblock))
      *(voice->myUI._freq_control) = midi_to_hz(note.pitch);
    voice=voice->next;
  }
}
void CPActionTranspose::Redo(CMainFrame &MainFrm)
{
	CSongView *pSongView = GET_SONG_VIEW();
	auto [b, e] = GetIterators(*pSongView);

	int ChanStart     = (m_pUndoState->IsSelecting ? m_pUndoState->Selection.m_cpStart : m_pUndoState->Cursor).Xpos.Track;
	int ChanEnd       = (m_pUndoState->IsSelecting ? m_pUndoState->Selection.m_cpEnd : m_pUndoState->Cursor).Xpos.Track;

	const bool bSingular = b == e && !m_pUndoState->IsSelecting;
	const unsigned Length = pSongView->GetSong().GetPatternLength();

	int Row = 0;		// // //
	int oldRow = -1;
	do {
		if (b.m_iRow <= oldRow)
			Row += Length + b.m_iRow - oldRow - 1;
		for (int i = ChanStart; i <= ChanEnd; ++i) {
			if (!m_pUndoState->Selection.IsColumnSelected(column_t::Note, i))
				continue;
			stChanNote Note = *(m_UndoClipData.GetPattern(i - ChanStart, Row));		// // //
			if (Note.Note == note_t::echo) {
				if (!bSingular)
					continue;
				switch (m_iTransposeAmount) {		// // //
				case -1: case 1:
					if (Note.Octave > 0)
						--Note.Octave;
					break;
				case -NOTE_RANGE: case NOTE_RANGE:
					if (Note.Octave < ECHO_BUFFER_LENGTH - 1)
						++Note.Octave;
					break;
				}
			}
			else if (is_note(Note.Note)) {		// // //
				int NewNote = std::clamp(Note.ToMidiNote() + m_iTransposeAmount, 0, NOTE_COUNT - 1);
				Note.Note = ft0cc::doc::pitch_from_midi(NewNote);
				Note.Octave = ft0cc::doc::oct_from_midi(NewNote);
			}
			else
				continue;
			b.Set(i, Note);
		}
		++Row;
		oldRow = b.m_iRow;
	} while (++b <= e);
}
void CChannelHandlerFDS::HandleNoteData(stChanNote &NoteData)		// // //
{
	m_iEffModDepth = -1;
	if (!m_bAutoModulation) {		// // //
		m_iEffModSpeedHi = -1;
		m_iEffModSpeedLo = -1;
	}
	m_bVolModTrigger = false;		// // //

	CChannelHandlerInverted::HandleNoteData(NoteData);
	// // //
	if (is_note(NoteData.Note) || NoteData.Note == note_t::echo)
		m_bVolModTrigger = true;

	if (m_iEffModDepth != -1)
		m_iModulationDepth = m_iEffModDepth;

	if (m_iEffModSpeedHi != -1)
		m_iModulationSpeed = (m_iModulationSpeed & 0xFF) | (m_iEffModSpeedHi << 8);

	if (m_iEffModSpeedLo != -1)
		m_iModulationSpeed = (m_iModulationSpeed & 0xF00) | m_iEffModSpeedLo;
}
void CPActionInterpolate::Redo(CMainFrame &MainFrm)
{
	CSongView *pSongView = GET_SONG_VIEW();
	auto [b, e] = GetIterators(*pSongView);
	const CSelection &Sel = m_pUndoState->Selection;

	for (int i = Sel.m_cpStart.Xpos.Track; i <= Sel.m_cpEnd.Xpos.Track; ++i) {
		const int Columns = pSongView->GetEffectColumnCount(i) + 4;		// // //
		for (int j = 0; j < Columns; ++j) {
			if (!Sel.IsColumnSelected(static_cast<column_t>(j), i)) continue;
			CPatternIterator r {b};		// // //
			const auto &StartData = r.Get(i);
			const auto &EndData = e.Get(i);
			double StartValHi = 0., StartValLo = 0.;		// // //
			double EndValHi = 0., EndValLo = 0.;
			double DeltaHi = 0., DeltaLo = 0.;
			bool TwoParam = false;
			effect_t Effect = effect_t::none;
			switch (static_cast<column_t>(j)) {
			case column_t::Note:
				if (!is_note(StartData.Note) || !is_note(EndData.Note))
					continue;
				StartValLo = (float)StartData.ToMidiNote();
				EndValLo = (float)EndData.ToMidiNote();
				break;
			case column_t::Instrument:
				if (StartData.Instrument == MAX_INSTRUMENTS || EndData.Instrument == MAX_INSTRUMENTS)
					continue;
				if (StartData.Instrument == HOLD_INSTRUMENT || EndData.Instrument == HOLD_INSTRUMENT)		// // // 050B
					continue;
				StartValLo = (float)StartData.Instrument;
				EndValLo = (float)EndData.Instrument;
				break;
			case column_t::Volume:
				if (StartData.Vol == MAX_VOLUME || EndData.Vol == MAX_VOLUME)
					continue;
				StartValLo = (float)StartData.Vol;
				EndValLo = (float)EndData.Vol;
				break;
			case column_t::Effect1: case column_t::Effect2: case column_t::Effect3: case column_t::Effect4:
				if (StartData.Effects[j - 3].fx == effect_t::none || EndData.Effects[j - 3].fx == effect_t::none ||
					StartData.Effects[j - 3].fx != EndData.Effects[j - 3].fx)
					continue;
				StartValLo = (float)StartData.Effects[j - 3].param;
				EndValLo = (float)EndData.Effects[j - 3].param;
				Effect = StartData.Effects[j - 3].fx;
				switch (Effect) {
				case effect_t::SWEEPUP: case effect_t::SWEEPDOWN: case effect_t::SLIDE_UP: case effect_t::SLIDE_DOWN:
				case effect_t::ARPEGGIO: case effect_t::VIBRATO: case effect_t::TREMOLO:
				case effect_t::VOLUME_SLIDE: case effect_t::DELAYED_VOLUME: case effect_t::TRANSPOSE:
					TwoParam = true;
				}
				break;
			}

			if (TwoParam) {
				StartValHi = std::floor(StartValLo / 16.0);
				StartValLo = std::fmod(StartValLo, 16.0);
				EndValHi = std::floor(EndValLo / 16.0);
				EndValLo = std::fmod(EndValLo, 16.0);
			}
			else
				StartValHi = EndValHi = 0.0;
			DeltaHi = (EndValHi - StartValHi) / float(m_iSelectionSize - 1);
			DeltaLo = (EndValLo - StartValLo) / float(m_iSelectionSize - 1);

			while (++r < e) {
				StartValLo += DeltaLo;
				StartValHi += DeltaHi;
				auto Note = r.Get(i);
				switch (static_cast<column_t>(j)) {
				case column_t::Note:
					Note.Note = ft0cc::doc::pitch_from_midi((int)StartValLo);
					Note.Octave = ft0cc::doc::oct_from_midi((int)StartValLo);
					break;
				case column_t::Instrument:
					Note.Instrument = (int)StartValLo;
					break;
				case column_t::Volume:
					Note.Vol = (int)StartValLo;
					break;
				case column_t::Effect1: case column_t::Effect2: case column_t::Effect3: case column_t::Effect4:
					Note.Effects[j - 3].fx = Effect;
					Note.Effects[j - 3].param = (int)StartValLo + ((int)StartValHi << 4);
					break;
				}
				r.Set(i, Note);
			}
		}
	}
}