Skip to content

Commit

Permalink
features and bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewShakinovsky-SAS committed Oct 25, 2024
1 parent 9f2f4fb commit 61f3318
Show file tree
Hide file tree
Showing 11 changed files with 199 additions and 96 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.3.10
1.3.11
3 changes: 2 additions & 1 deletion src/Constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,8 @@ in mono mode are 0..high val where 0 is off, and the following applies
#define SEQMIDI_ACTION_RESET 6 // reset one of the above to default (use id above to signify which)
#define SEQMIDI_ACTION_PBIAS 7 // poly bias (variable. value passed will be the cc value)
#define SEQMIDI_ACTION_PLAYBACK 8 // start/stop playback (not layer specific)
#define SEQMIDI_ACTION_RECORD 9 // start/stop record (not layer specific)
#define SEQMIDI_ACTION_RECORD 9 // start/stop record (not layer specific)
#define SEQMIDI_ACTION_POSVAR 10 // position variance

// midi mapping
// targets (1-4 are layers 1-4)
Expand Down
12 changes: 8 additions & 4 deletions src/MidiDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,13 @@ void SeqMidiDialog::midiMsgReceived(int8_t type, int8_t chan, int8_t num, int8_t
if (mLearningRow!=-1) {
SeqMidiMapItem mi;
mi = mMapping.getUnchecked(mLearningRow);
// these actions are CC
auto isCC = (mi.mAction == SEQMIDI_ACTION_PBIAS || mi.mAction == SEQMIDI_ACTION_POSVAR);

// using a CC for a non-cc type action is not accepted
// using a note for a cc-type is not accepted either
if((mi.mAction == SEQMIDI_ACTION_PBIAS && type ==SEQ_MIDI_CC) ||
(mi.mAction != SEQMIDI_ACTION_PBIAS && (type == SEQ_MIDI_NOTEON||type==SEQ_MIDI_NOTEOFF))) {
if((isCC && type ==SEQ_MIDI_CC) ||
(!isCC && (type == SEQ_MIDI_NOTEON||type==SEQ_MIDI_NOTEOFF))) {

mi.mChannel = chan;
if (type == SEQ_MIDI_NOTEOFF) {
Expand Down Expand Up @@ -393,6 +395,7 @@ void SeqMidiRow::addActionsToCombo(ComboBox & cb, bool addall)
cb.addItem("Transpose", SEQMIDI_ACTION_TRANS);
cb.addItem("Set Num Steps", SEQMIDI_ACTION_STEPS);
cb.addItem("Set Poly Bias", SEQMIDI_ACTION_PBIAS);
cb.addItem("Set Position Variance", SEQMIDI_ACTION_POSVAR);
cb.addItem("Playback", SEQMIDI_ACTION_PLAYBACK);
cb.addItem("Record", SEQMIDI_ACTION_RECORD);
if(addall) // this would not be added when the list is being used as a target
Expand Down Expand Up @@ -440,7 +443,7 @@ void SeqMidiRow::comboBoxChanged(ComboBox * comboBox) {
// action changed
// update the action
m.mAction = (int8_t)(mCBAction.getSelectedId());
if (m.mAction == SEQMIDI_ACTION_PBIAS) {
if (m.mAction == SEQMIDI_ACTION_PBIAS || m.mAction == SEQMIDI_ACTION_POSVAR) {
m.mType = SEQ_MIDI_CC;
m.mValue = SEQMIDI_VALUE_VARIABLE;
mNumNote.setSpec(0, 127, 1, 0, "");
Expand Down Expand Up @@ -538,6 +541,7 @@ SeqMidiRow::fillValueListBasedOnAction()
addActionsToCombo(mCBValue,false);
break;
case SEQMIDI_ACTION_PBIAS:
case SEQMIDI_ACTION_POSVAR:
// no items
mCBValue.addItem("CC Value", SEQMIDI_VALUE_VARIABLE);
mCBValue.setEnabled(false);
Expand Down Expand Up @@ -606,7 +610,7 @@ bool SeqMidiRow::getNumberCptCustomText(int id, int value, String & repl)
jassert(id == SEQMIDI_CPT_NOTE);
jassert(value >= -128 && value < 128);
int action = mCBAction.getSelectedId();
if (action == SEQMIDI_ACTION_PBIAS) {
if (action == SEQMIDI_ACTION_PBIAS || action == SEQMIDI_ACTION_POSVAR) {
repl << "CC" << value;
}
else {
Expand Down
2 changes: 1 addition & 1 deletion src/NotePanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ void NoteCpt::labelTextChanged(Label * lbl)
s= lbl->getText(false);
strncpy(noteBuf, s.getCharPointer(), SEQ_MAX_NOTELABEL_LEN);
data->setNoteName(mId, noteBuf);

mGlob->mSeqBuf->swap();
}

void NoteCpt::resized()
Expand Down
29 changes: 16 additions & 13 deletions src/Persist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ void SeqPersist::retrieveLayer(XmlElement * e, SequenceLayer * lay)
int idx;
sval = e->getStringAttribute("name");
lay->setLayerName(sval.getCharPointer());
forEachXmlChildElement(*e, ch) {
for (auto* ch : e->getChildIterator()) {
if (ch->hasTagName("humlen")) {
if (getKeyVal(ch, &ival))
lay->setHumanLength((int)ival);
Expand Down Expand Up @@ -195,20 +195,23 @@ void SeqPersist::retrieveLayer(XmlElement * e, SequenceLayer * lay)
lay->setMaxRows((int)ival);
}
else if (ch->hasTagName("notes")) {
forEachXmlChildElementWithTagName(*ch, note,"n") {
for (auto* note : ch->getChildWithTagNameIterator("n")) {
idx = note->getIntAttribute("idx");
if (idx >= 0 && idx < SEQ_MAX_ROWS) {
val = note->getIntAttribute("std");
lay->setNote(idx, (int8_t)val, false);
val = note->getIntAttribute("cust");
lay->setNote(idx, (int8_t)val, true);
sval = note->getStringAttribute("name");
lay->setNoteName(idx, sval.getCharPointer());
auto s = sval.getCharPointer();
if(strlen(s)) {
lay->setNoteName(idx, s);
}
}
}
}
else if (ch->hasTagName("pats")) {
forEachXmlChildElementWithTagName(*ch, pat,"p") {
for (auto* pat : ch->getChildWithTagNameIterator("p")) {
retrievePattern(pat, lay);
}
}
Expand Down Expand Up @@ -254,20 +257,20 @@ void SeqPersist::retrievePattern(XmlElement * e, SequenceLayer * lay)
if(sval.length()) // if differs from default it will be saved
lay->setPatternName(sval.getCharPointer(), pat);

forEachXmlChildElementWithTagName(*e, ch,"rows") {
forEachXmlChildElementWithTagName(*ch, row, "r") {
for (auto* ch : e->getChildWithTagNameIterator("rows")) {
for (auto* row : ch->getChildWithTagNameIterator("r")) {
int rowidx=row->getIntAttribute("idx");
if (rowidx >= 0 && rowidx < SEQ_MAX_ROWS) {
forEachXmlChildElementWithTagName(*row, cells, "cells") {
forEachXmlChildElementWithTagName(*cells, cell, "c") {
for (auto* cells : row->getChildWithTagNameIterator("cells")) {
for (auto* cell : cells->getChildWithTagNameIterator("c")) {
int cellidx = cell->getIntAttribute("idx");
if (cellidx >= 0 && cellidx < SEQ_MAX_STEPS) {
lay->setProb(rowidx, cellidx, (int8_t)cell->getIntAttribute("prob", SEQ_PROB_OFF), pat);
lay->setVel(rowidx, cellidx, (int8_t)cell->getIntAttribute("velo"), pat);
lay->setLength(rowidx, cellidx, (int8_t)cell->getIntAttribute("len"), pat);
lay->setOffset(rowidx, cellidx, (int8_t)cell->getIntAttribute("offs"), pat);

forEachXmlChildElementWithTagName(*cell, cs, "cs") {
for (auto* cs : cell->getChildWithTagNameIterator("cs")) {
int srcRow=cs->getIntAttribute("row");
int srcStep=cs->getIntAttribute("col");
bool negtgt=(cs->getIntAttribute("neg") == 1);
Expand Down Expand Up @@ -435,9 +438,9 @@ bool SeqPersist::retrieve(SequenceData * targetData, const XmlElement * sourceDa
std::unique_ptr<SequenceData> dummy(new SequenceData());
*targetData = *dummy;

forEachXmlChildElement(*sourceData, e) {
for(auto *e : sourceData->getChildIterator()) {
if (e->hasTagName("groove")) {
forEachXmlChildElement(*e, g) {
for(auto *g : e->getChildIterator()) {
if (g->hasTagName("i")) {
idx = g->getIntAttribute("idx");
val = g->getIntAttribute("val");
Expand All @@ -449,7 +452,7 @@ bool SeqPersist::retrieve(SequenceData * targetData, const XmlElement * sourceDa

else if (e->hasTagName("midimap")) {
int mapcount = 0;
forEachXmlChildElement(*e, m) {
for(auto *m : e->getChildIterator()) {
if (m->hasTagName("mm")) {
idx = m->getIntAttribute("idx");
if (idx >= 0 && idx < SEQMIDI_MAX_ITEMS) {
Expand All @@ -468,7 +471,7 @@ bool SeqPersist::retrieve(SequenceData * targetData, const XmlElement * sourceDa
} // end midimap

else if (e->hasTagName("layer")) {
forEachXmlChildElementWithTagName(*e, l,"l") {
for (auto* l : e->getChildWithTagNameIterator("l")) {
idx=l->getIntAttribute("idx");
if (idx >= 0 && idx < SEQ_MAX_LAYERS)
retrieveLayer(l, targetData->getLayer(idx));
Expand Down
5 changes: 4 additions & 1 deletion src/PluginProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ SeqAudioProcessor::SeqAudioProcessor() :

// this dummy parameter just used to tell the host that we need a "save" when the user
// modifies some parameter
addParameter(mDummyParam=new AudioParameterFloat("_rsvd","reserved",NormalisableRange<float>(0.0f, 1.0f),0.0f));
addParameter(mDummyParam=new AudioParameterFloat(
ParameterID("_rsvd", 1), // this version hint has something to do with AU and is to avoid a runtime assert
"reserved",NormalisableRange<float>(0.0f, 1.0f),0.0f));

// note that this is accessed from the UI thread as well!!
// avoid non-atomic operations
Expand Down Expand Up @@ -1253,6 +1255,7 @@ float SeqAudioProcessorParameter::getValueForText(const String & text) const

SeqAudioProcessorParameter::SeqAudioProcessorParameter(AutParamNotify * notify,
int paramId, int rangeLo, int rangeHi, int layerNum, const String &name) :
AudioProcessorParameter(1), // fix the assert. if we add more aut params later this num needs to increase for new ones
mNotify(notify), mLayerNumber(layerNum), mParamId(paramId), mRangeLo(rangeLo),
mRangeHi(rangeHi),mValue(rangeLo-1),mName(name)
{
Expand Down
5 changes: 3 additions & 2 deletions src/PluginProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,9 @@ class SeqPlaybackParameter : public AudioProcessorParameter {
// should return a string representing the value
bool isAutomatable() const override { return true; }
public:
SeqPlaybackParameter(SeqAudioProcessor *parent) : mParent(parent),mValue(0) {}

explicit SeqPlaybackParameter(SeqAudioProcessor *parent) :
AudioProcessorParameter(1), // fix the assert. if we add more aut params later this num needs to increase for new ones
mParent(parent),mValue(0) {}
};

// for recording midi
Expand Down
Loading

0 comments on commit 61f3318

Please sign in to comment.