Browse Source

A Johnson's matrix fix

master
edgeeffect 21 years ago
parent
commit
00ae2150fa
3 changed files with 47 additions and 83 deletions
  1. +1
    -1
      README
  2. +43
    -81
      SpiralSound/Plugins/MatrixPlugin/MatrixPlugin.C
  3. +3
    -1
      SpiralSound/Plugins/MatrixPlugin/MatrixPluginGUI.C

+ 1
- 1
README View File

@@ -131,6 +131,6 @@ or implied warranty.
(Damage to ears, speakers or buildings are not my fault :))

Dave Griffiths (Headmaster) - dave@pawfal.org
Andy Preston (Caretaker) - edgeeffect@sourceforge.net
Andy Preston (Caretaker) - andy@clubunix.co.uk

www.pawfal.org

+ 43
- 81
SpiralSound/Plugins/MatrixPlugin/MatrixPlugin.C View File

@@ -117,7 +117,7 @@ m_PatReset(false)

for (int n=0; n<NUM_PATSEQ; n++)
{
m_PatSeq[n]=0;
if (n ==0) m_PatSeq[n]=0; else m_PatSeq[n]=-1;
}

m_AudioCH->Register("NoteCut",&m_NoteCut,ChannelHandler::INPUT);
@@ -416,84 +416,46 @@ void MatrixPlugin::StreamOut(ostream &s)

}

void MatrixPlugin::StreamIn(istream &s)
{
int version;
s>>version;

switch (version)
{
case 1:
{
s>>m_Current>>m_Time>>m_Step>>m_Loop>>m_NoteCut;

for (int n=0; n<NUM_PATTERNS; n++)
{
s>>m_Matrix[n].Length>>m_Matrix[n].Speed>>m_Matrix[n].Octave;
for (int y=0; y<MATY; y++)
for (int x=0; x<MATX; x++)
{
s>>m_Matrix[n].Matrix[x][y];
}
}
} break;
case 2:
{
s>>m_Current>>m_Time>>m_Step>>m_Loop>>m_NoteCut;
for (int n=0; n<NUM_PATTERNS; n++)
{
s>>m_Matrix[n].Length>>m_Matrix[n].Speed>>m_Matrix[n].Octave;
int x=0,y=0;
while(x!=-1)
{
s>>x;
if (x!=-1)
{
s>>y;
if (y!=-1) m_Matrix[n].Matrix[x][y]=true;
}
}
}
} break;
case 3:
case 4:
{
s>>m_Current>>m_Time>>m_Step>>m_Loop>>m_NoteCut;
for (int n=0; n<NUM_PATTERNS; n++)
{
s>>m_Matrix[n].Length>>m_Matrix[n].Speed>>m_Matrix[n].Octave;
int x=0,y=0;
float v;
while(x!=-1)
{
s>>x;
if (x!=-1)
{
s>>y>>v;
if (y!=-1)
{
m_Matrix[n].Matrix[x][y]=true;
m_Matrix[n].Volume[x][y]=v;
}
}
}
}
if (version>3)
{
for (int n=0; n<NUM_PATSEQ; n++)
{
s>>m_PatSeq[n];
}
}
} break;
}
void MatrixPlugin::StreamIn (istream &s) {
int version;
s >> version;
s >> m_Current >> m_Time >> m_Step >> m_Loop >> m_NoteCut;
for (int n=0; n<NUM_PATTERNS; n++) {
s >> m_Matrix[n].Length >> m_Matrix[n].Speed >> m_Matrix[n].Octave;
if (version == 1) {
for (int y=0; y<MATY; y++)
for (int x=0; x<MATX; x++)
s >> m_Matrix[n].Matrix[x][y];
}
else {
// version > 1
float vol;
int x=0, y=0;
while (x!=-1) {
s >> x;
if (x != -1) {
if (version == 2) {
s >> y;
if (y != -1) m_Matrix[n].Matrix[x][y] = true;
}
else {
// version > 2
s >> y >> vol;
if (y != -1) {
m_Matrix[n].Matrix[x][y] = true;
m_Matrix[n].Volume[x][y] = vol;
}
}
}
}
}
}
if (version > 3) {
int ps;
for (int n=0; n<NUM_PATSEQ; n++) {
s >> ps;
if (n==0 && ps<0) ps = 0;
m_PatSeq[n] = ps;
}
}
}

+ 3
- 1
SpiralSound/Plugins/MatrixPlugin/MatrixPluginGUI.C View File

@@ -292,7 +292,9 @@ m_LastPatSeqLight(0)
m_PatSeq[y]->type(FL_SIMPLE_COUNTER);
m_PatSeq[y]->step(1);
m_PatSeq[y]->textsize(8);
m_PatSeq[y]->minimum (-1);
if (y==0) m_PatSeq[y]->minimum (0);
else m_PatSeq[y]->minimum (-1);
m_PatSeq[y]->value (m_PatSeq[y]->minimum ());
m_PatSeq[y]->maximum (NUM_PATTERNS-1);
m_PatSeq[y]->callback((Fl_Callback*)cb_PatSeq,(void*)&Numbers[y]);
add(m_PatSeq[y]);


Loading…
Cancel
Save