Rename TCO and related to Clip (#6226)
This PR renames
TCO -> Clip
Pattern -> MidiClip
*TCO and *TCOView -> *Clip and *ClipView
The savefiles are not yet modified by this PR.
This commit is contained in:
committed by
GitHub
parent
bf323d2024
commit
55d361fb65
@@ -13,7 +13,7 @@
|
||||
#include "Instrument.h"
|
||||
#include "InstrumentTrack.h"
|
||||
#include "Note.h"
|
||||
#include "Pattern.h"
|
||||
#include "MidiClip.h"
|
||||
#include "Track.h"
|
||||
#include "BBTrack.h"
|
||||
#include "BBTrackContainer.h"
|
||||
@@ -280,7 +280,7 @@ bool HydrogenImport::readSong()
|
||||
QString instrId = LocalFileMng::readXmlString( noteNode, "instrument", 0,false, false );
|
||||
int i = pattern_count - 1 + nbb;
|
||||
pattern_id[sName] = pattern_count - 1;
|
||||
Pattern*p = dynamic_cast<Pattern*>( drum_track[instrId]->getTCO( i ) );
|
||||
MidiClip*p = dynamic_cast<MidiClip*>( drum_track[instrId]->getClip( i ) );
|
||||
Note n;
|
||||
n.setPos( nPosition );
|
||||
if ( (nPosition + 48) <= nSize )
|
||||
@@ -301,7 +301,7 @@ bool HydrogenImport::readSong()
|
||||
}
|
||||
patternNode = ( QDomNode ) patternNode.nextSiblingElement( "pattern" );
|
||||
}
|
||||
// Pattern sequence
|
||||
// MidiClip sequence
|
||||
QDomNode patternSequenceNode = songNode.firstChildElement( "patternSequence" );
|
||||
QDomNode groupNode = patternSequenceNode.firstChildElement( "group" );
|
||||
int pos = 0;
|
||||
@@ -316,7 +316,7 @@ bool HydrogenImport::readSong()
|
||||
|
||||
int i = pattern_id[patId]+song_num_tracks;
|
||||
Track *t = ( BBTrack * ) s->tracks().at( i );
|
||||
t->createTCO(pos);
|
||||
t->createClip(pos);
|
||||
|
||||
if ( pattern_length[patId] > best_length )
|
||||
{
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#include "LadspaControl.h"
|
||||
#include "LadspaSubPluginFeatures.h"
|
||||
#include "EffectChain.h"
|
||||
#include "AutomationPattern.h"
|
||||
#include "AutomationClip.h"
|
||||
#include "ControllerConnection.h"
|
||||
#include "MemoryManager.h"
|
||||
#include "ValueBuffer.h"
|
||||
@@ -122,7 +122,7 @@ void LadspaEffect::changeSampleRate()
|
||||
|
||||
// the IDs of re-created controls have been saved and now need to be
|
||||
// resolved again
|
||||
AutomationPattern::resolveAllIDs();
|
||||
AutomationClip::resolveAllIDs();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -122,7 +122,7 @@ bool MidiExport::tryExport(const TrackContainer::TrackList &tracks,
|
||||
double base_volume = 1.0;
|
||||
int base_time = 0;
|
||||
|
||||
MidiNoteVector pat;
|
||||
MidiNoteVector midiClip;
|
||||
|
||||
for (QDomNode n = element.firstChild(); !n.isNull(); n = n.nextSibling())
|
||||
{
|
||||
@@ -138,15 +138,15 @@ bool MidiExport::tryExport(const TrackContainer::TrackList &tracks,
|
||||
base_volume = LocaleHelper::toDouble(it.attribute("volume", "100"))/100.0;
|
||||
}
|
||||
|
||||
if (n.nodeName() == "pattern")
|
||||
if (n.nodeName() == "pattern") //TODO: rename to "midiClip"
|
||||
{
|
||||
base_time = n.toElement().attribute("pos", "0").toInt();
|
||||
writePattern(pat, n, base_pitch, base_volume, base_time);
|
||||
writeMidiClip(midiClip, n, base_pitch, base_volume, base_time);
|
||||
}
|
||||
|
||||
}
|
||||
ProcessBBNotes(pat, INT_MAX);
|
||||
writePatternToTrack(mtrack, pat);
|
||||
ProcessBBNotes(midiClip, INT_MAX);
|
||||
writeMidiClipToTrack(mtrack, midiClip);
|
||||
size = mtrack.writeToBuffer(buffer);
|
||||
midiout.writeRawData((char *)buffer, size);
|
||||
}
|
||||
@@ -160,7 +160,7 @@ bool MidiExport::tryExport(const TrackContainer::TrackList &tracks,
|
||||
for (QDomNode n = element.firstChild(); !n.isNull(); n = n.nextSibling())
|
||||
{
|
||||
|
||||
if (n.nodeName() == "bbtco")
|
||||
if (n.nodeName() == "bbclip")
|
||||
{
|
||||
QDomElement it = n.toElement();
|
||||
int pos = it.attribute("pos", "0").toInt();
|
||||
@@ -208,28 +208,28 @@ bool MidiExport::tryExport(const TrackContainer::TrackList &tracks,
|
||||
base_volume = LocaleHelper::toDouble(it.attribute("volume", "100")) / 100.0;
|
||||
}
|
||||
|
||||
if (n.nodeName() == "pattern")
|
||||
if (n.nodeName() == "pattern") //TODO: rename to "midiClip"
|
||||
{
|
||||
std::vector<std::pair<int,int>> &plist = *itr;
|
||||
|
||||
MidiNoteVector nv, pat;
|
||||
writePattern(pat, n, base_pitch, base_volume, 0);
|
||||
MidiNoteVector nv, midiClip;
|
||||
writeMidiClip(midiClip, n, base_pitch, base_volume, 0);
|
||||
|
||||
// workaround for nested BBTCOs
|
||||
// workaround for nested BBClips
|
||||
int pos = 0;
|
||||
int len = n.toElement().attribute("steps", "1").toInt() * 12;
|
||||
for (auto it = plist.begin(); it != plist.end(); ++it)
|
||||
{
|
||||
while (!st.empty() && st.back().second <= it->first)
|
||||
{
|
||||
writeBBPattern(pat, nv, len, st.back().first, pos, st.back().second);
|
||||
writeBBClip(midiClip, nv, len, st.back().first, pos, st.back().second);
|
||||
pos = st.back().second;
|
||||
st.pop_back();
|
||||
}
|
||||
|
||||
if (!st.empty() && st.back().second <= it->second)
|
||||
{
|
||||
writeBBPattern(pat, nv, len, st.back().first, pos, it->first);
|
||||
writeBBClip(midiClip, nv, len, st.back().first, pos, it->first);
|
||||
pos = it->first;
|
||||
while (!st.empty() && st.back().second <= it->second)
|
||||
{
|
||||
@@ -243,13 +243,13 @@ bool MidiExport::tryExport(const TrackContainer::TrackList &tracks,
|
||||
|
||||
while (!st.empty())
|
||||
{
|
||||
writeBBPattern(pat, nv, len, st.back().first, pos, st.back().second);
|
||||
writeBBClip(midiClip, nv, len, st.back().first, pos, st.back().second);
|
||||
pos = st.back().second;
|
||||
st.pop_back();
|
||||
}
|
||||
|
||||
ProcessBBNotes(nv, pos);
|
||||
writePatternToTrack(mtrack, nv);
|
||||
writeMidiClipToTrack(mtrack, nv);
|
||||
++itr;
|
||||
}
|
||||
}
|
||||
@@ -263,7 +263,7 @@ bool MidiExport::tryExport(const TrackContainer::TrackList &tracks,
|
||||
|
||||
|
||||
|
||||
void MidiExport::writePattern(MidiNoteVector &pat, QDomNode n,
|
||||
void MidiExport::writeMidiClip(MidiNoteVector &midiClip, QDomNode n,
|
||||
int base_pitch, double base_volume, int base_time)
|
||||
{
|
||||
// TODO interpret steps="12" muted="0" type="1" name="Piano1" len="2592"
|
||||
@@ -278,13 +278,13 @@ void MidiExport::writePattern(MidiNoteVector &pat, QDomNode n,
|
||||
mnote.volume = qMin(qRound(base_volume * LocaleHelper::toDouble(note.attribute("vol", "100")) * (127.0 / 200.0)), 127);
|
||||
mnote.time = base_time + note.attribute("pos", "0").toInt();
|
||||
mnote.duration = note.attribute("len", "0").toInt();
|
||||
pat.push_back(mnote);
|
||||
midiClip.push_back(mnote);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void MidiExport::writePatternToTrack(MTrack &mtrack, MidiNoteVector &nv)
|
||||
void MidiExport::writeMidiClipToTrack(MTrack &mtrack, MidiNoteVector &nv)
|
||||
{
|
||||
for (auto it = nv.begin(); it != nv.end(); ++it)
|
||||
{
|
||||
@@ -294,7 +294,7 @@ void MidiExport::writePatternToTrack(MTrack &mtrack, MidiNoteVector &nv)
|
||||
|
||||
|
||||
|
||||
void MidiExport::writeBBPattern(MidiNoteVector &src, MidiNoteVector &dst,
|
||||
void MidiExport::writeBBClip(MidiNoteVector &src, MidiNoteVector &dst,
|
||||
int len, int base, int start, int end)
|
||||
{
|
||||
if (start >= end) { return; }
|
||||
|
||||
@@ -70,10 +70,10 @@ public:
|
||||
int tempo, int masterPitch, const QString &filename);
|
||||
|
||||
private:
|
||||
void writePattern(MidiNoteVector &pat, QDomNode n,
|
||||
void writeMidiClip(MidiNoteVector &midiClip, QDomNode n,
|
||||
int base_pitch, double base_volume, int base_time);
|
||||
void writePatternToTrack(MTrack &mtrack, MidiNoteVector &nv);
|
||||
void writeBBPattern(MidiNoteVector &src, MidiNoteVector &dst,
|
||||
void writeMidiClipToTrack(MTrack &mtrack, MidiNoteVector &nv);
|
||||
void writeBBClip(MidiNoteVector &src, MidiNoteVector &dst,
|
||||
int len, int base, int start, int end);
|
||||
void ProcessBBNotes(MidiNoteVector &nv, int cutPos);
|
||||
|
||||
|
||||
@@ -37,9 +37,9 @@
|
||||
#include "TrackContainer.h"
|
||||
#include "InstrumentTrack.h"
|
||||
#include "AutomationTrack.h"
|
||||
#include "AutomationPattern.h"
|
||||
#include "AutomationClip.h"
|
||||
#include "ConfigManager.h"
|
||||
#include "Pattern.h"
|
||||
#include "MidiClip.h"
|
||||
#include "Instrument.h"
|
||||
#include "GuiApplication.h"
|
||||
#include "MainWindow.h"
|
||||
@@ -159,7 +159,7 @@ public:
|
||||
{ }
|
||||
|
||||
AutomationTrack * at;
|
||||
AutomationPattern * ap;
|
||||
AutomationClip * ap;
|
||||
TimePos lastPos;
|
||||
|
||||
smfMidiCC & create( TrackContainer* tc, QString tn )
|
||||
@@ -192,8 +192,8 @@ public:
|
||||
if( !ap || time > lastPos + DefaultTicksPerBar )
|
||||
{
|
||||
TimePos pPos = TimePos( time.getBar(), 0 );
|
||||
ap = dynamic_cast<AutomationPattern*>(
|
||||
at->createTCO(pPos));
|
||||
ap = dynamic_cast<AutomationClip*>(
|
||||
at->createClip(pPos));
|
||||
ap->addObject( objModel );
|
||||
}
|
||||
|
||||
@@ -221,7 +221,7 @@ public:
|
||||
{ }
|
||||
|
||||
InstrumentTrack * it;
|
||||
Pattern* p;
|
||||
MidiClip* p;
|
||||
Instrument * it_inst;
|
||||
bool isSF2;
|
||||
bool hasNotes;
|
||||
@@ -259,7 +259,7 @@ public:
|
||||
it->pitchRangeModel()->setInitValue( 2 );
|
||||
|
||||
// Create a default pattern
|
||||
p = dynamic_cast<Pattern*>(it->createTCO(0));
|
||||
p = dynamic_cast<MidiClip*>(it->createClip(0));
|
||||
}
|
||||
return this;
|
||||
}
|
||||
@@ -269,30 +269,30 @@ public:
|
||||
{
|
||||
if (!p)
|
||||
{
|
||||
p = dynamic_cast<Pattern*>(it->createTCO(0));
|
||||
p = dynamic_cast<MidiClip*>(it->createClip(0));
|
||||
}
|
||||
p->addNote(n, false);
|
||||
hasNotes = true;
|
||||
}
|
||||
|
||||
void splitPatterns()
|
||||
void splitMidiClips()
|
||||
{
|
||||
Pattern * newPattern = nullptr;
|
||||
MidiClip * newMidiClip = nullptr;
|
||||
TimePos lastEnd(0);
|
||||
|
||||
p->rearrangeAllNotes();
|
||||
for (auto n : p->notes())
|
||||
{
|
||||
if (!newPattern || n->pos() > lastEnd + DefaultTicksPerBar)
|
||||
if (!newMidiClip || n->pos() > lastEnd + DefaultTicksPerBar)
|
||||
{
|
||||
TimePos pPos = TimePos(n->pos().getBar(), 0);
|
||||
newPattern = dynamic_cast<Pattern*>(it->createTCO(pPos));
|
||||
newMidiClip = dynamic_cast<MidiClip*>(it->createClip(pPos));
|
||||
}
|
||||
lastEnd = n->pos() + n->length();
|
||||
|
||||
Note newNote(*n);
|
||||
newNote.setPos(n->pos(newPattern->startPosition()));
|
||||
newPattern->addNote(newNote, false);
|
||||
newNote.setPos(n->pos(newMidiClip->startPosition()));
|
||||
newMidiClip->addNote(newNote, false);
|
||||
}
|
||||
|
||||
delete p;
|
||||
@@ -336,12 +336,12 @@ bool MidiImport::readSMF( TrackContainer* tc )
|
||||
AutomationTrack * dt = dynamic_cast<AutomationTrack*>(
|
||||
Track::create(Track::AutomationTrack, Engine::getSong()));
|
||||
dt->setName(tr("MIDI Time Signature Denominator"));
|
||||
AutomationPattern * timeSigNumeratorPat =
|
||||
new AutomationPattern(nt);
|
||||
AutomationClip * timeSigNumeratorPat =
|
||||
new AutomationClip(nt);
|
||||
timeSigNumeratorPat->setDisplayName(tr("Numerator"));
|
||||
timeSigNumeratorPat->addObject(&timeSigMM.numeratorModel());
|
||||
AutomationPattern * timeSigDenominatorPat =
|
||||
new AutomationPattern(dt);
|
||||
AutomationClip * timeSigDenominatorPat =
|
||||
new AutomationClip(dt);
|
||||
timeSigDenominatorPat->setDisplayName(tr("Denominator"));
|
||||
timeSigDenominatorPat->addObject(&timeSigMM.denominatorModel());
|
||||
|
||||
@@ -364,7 +364,7 @@ bool MidiImport::readSMF( TrackContainer* tc )
|
||||
pd.setValue( 2 );
|
||||
|
||||
// Tempo stuff
|
||||
AutomationPattern * tap = tc->tempoAutomationPattern();
|
||||
AutomationClip * tap = tc->tempoAutomationClip();
|
||||
if( tap )
|
||||
{
|
||||
tap->clear();
|
||||
@@ -565,7 +565,7 @@ bool MidiImport::readSMF( TrackContainer* tc )
|
||||
{
|
||||
if (c.second.hasNotes)
|
||||
{
|
||||
c.second.splitPatterns();
|
||||
c.second.splitMidiClips();
|
||||
}
|
||||
else if (c.second.it)
|
||||
{
|
||||
|
||||
@@ -577,7 +577,7 @@ void AudioFileProcessorView::dragEnterEvent( QDragEnterEvent * _dee )
|
||||
{
|
||||
QString txt = _dee->mimeData()->data(
|
||||
mimeType( MimeType::StringPair ) );
|
||||
if( txt.section( ':', 0, 0 ) == QString( "tco_%1" ).arg(
|
||||
if( txt.section( ':', 0, 0 ) == QString( "clip_%1" ).arg(
|
||||
Track::SampleTrack ) )
|
||||
{
|
||||
_dee->acceptProposedAction();
|
||||
@@ -630,7 +630,7 @@ void AudioFileProcessorView::dropEvent( QDropEvent * _de )
|
||||
newWaveView();
|
||||
return;
|
||||
}
|
||||
else if( type == QString( "tco_%1" ).arg( Track::SampleTrack ) )
|
||||
else if( type == QString( "clip_%1" ).arg( Track::SampleTrack ) )
|
||||
{
|
||||
DataFile dataFile( value.toUtf8() );
|
||||
castModel<audioFileProcessor>()->setAudioFile( dataFile.content().firstChild().toElement().attribute( "src" ) );
|
||||
|
||||
Reference in New Issue
Block a user