Le mercredi 18 janvier 2012 à 09:34 +0100, Clemens Ladisch a écrit :
Philippe Carriere wrote:
> Le mardi 17 janvier 2012 à 22:59 +0100, Clemens Ladisch a écrit :
> > Philippe Carriere wrote:
> > > Clearly, matrix-mixer works  when exchanging the role of
> > > m_eap.m_mixer_nb_rx and m_eap.m_mixer_nb_tx in EAP::Mixer::getRowCount()
> > > and EAP::Mixer::getColCount() (dice_eap_cpp)
> >
> > Yes, the functions in this class do not agree whether inputs/outputs
> > are rows or columns.
> >
> > > concerning the saffire pro 40, the one-dimensional array
> > > first varies with inputs coefficients then with the outputs ones
> >
> > This is the format of all DICE EAP devices;
>
> So, what would be your recommandation ? Proposing a definitive
> modification of EAP::Mixer::getRowCount() and EAP::Mixer::getColCount() ?

I don't have a matrix-capable device myself, but from looking at the
Focusrite and Fireworks code, the convention is that inputs are rows and
outputs are columns.  In the DICE EAP code, matrix mixer inputs are also
named "tx" and outputs "rx".

I did some more works this evening, first modifying in the sense you indicated, but:

Therefore, the following functions are correct:
  EAP::Mixer::init()
This one is whatever correct.

  EAP::Mixer::loadCoefficients()
  EAP::Mixer::storeCoefficients()
These two later ones would also require modification to agree what ffado-mixer; more precisely, one would have to transpose the matrix one just read.

  EAP::Mixer::canWrite( const int row, const int col)
  EAP::Mixer::getRowCount()
  EAP::Mixer::getColCount()
These three later would remain unchanged.

while these are wrong:
  EAP::Mixer::show()
  EAP::Mixer::setValue( const int row, const int col, const double val)
  EAP::Mixer::getValue( const int row, const int col)

These three ones would require minor changes (exchanging the role of rows/columns with respect to inputs/outputs).

Avoiding the matrix transposition saves a lot of work and cpu. So I had a look to other parts of dice code and even Fireworks one and didn't see where reverting the convention would be of any impact.

So I returned back and modify
    EAP::Mixer::canWrite( const int row, const int col)
    EAP::Mixer::getRowCount()
    EAP::Mixer::getColCount()
according to the convention that inputs will be columns and outputs will be rows as represented in faddo-mixer matrix-mixer.

Maybe Jonathan who use a RME device may tell us what matrix-mixer looks like to in his case ?

I also corrected saffire pro 40 configuration so that now I am able to modify routing using ffado-mixer; I successfully tested a lot of different routing for analogic and ieee1394 connections but had no ability to test ADAT nor SPDIF connections. I am just sure they are routed as previously prescribed under windows. I also checked that "loop back" is just 1394:18 and 1394:19 outputs: probably, it would be better to rename these two ones, but I postponed such a modif

I join a patch candidate at the end of the email in order you will have a look to.

Regards,
Clemens

Regards,

Phil

Index: src/dice/focusrite/saffire_pro40.cpp
===================================================================
--- src/dice/focusrite/saffire_pro40.cpp (révision 2019)
+++ src/dice/focusrite/saffire_pro40.cpp (copie de travail)
@@ -24,7 +24,21 @@
#include "saffire_pro40.h"

#include "focusrite_eap.h"
-
+//
+// Under 48kHz Saffire pro 40 has
+//  - 8 analogic inputs (mic/line)
+//  - 8 ADAT inputs
+//  - 2 SPDIF inputs
+//  - 20 ieee1394 inputs
+//
+//  - 18 mixer inputs
+//
+//  - 16 mixer outputs
+//  - 10 analogic outputs
+//  - 8 ADAT outputs
+//  - 2 SPDIF outputs
+//  - 20 ieee1394 outputs
+//
namespace Dice {
namespace Focusrite {

@@ -44,20 +58,23 @@
}

void SaffirePro40::SaffirePro40EAP::setupSources() {
-    addSource("SPDIF",  6,  2, eRS_AES);
+    addSource("SPDIF",  0,  2, eRS_AES);
     addSource("ADAT",   0,  8, eRS_ADAT);
-    addSource("Analog", 0,  8, eRS_InS0);
+    addSource("Analog", 16,  8, eRS_InS0);
     addSource("Mixer",  0, 16, eRS_Mixer);
-    addSource("1394",   0, 16, eRS_ARX0);
+    addSource("1394",   0, 10, eRS_ARX0);
+    addSource("1394",   0, 10, eRS_ARX1, 10);
     addSource("Mute",   0,  1, eRS_Muted);
}
void SaffirePro40::SaffirePro40EAP::setupDestinations() {
-    addDestination("SPDIF",  6,  2, eRD_AES);
+    addDestination("SPDIF",  0,  2, eRD_AES);
     addDestination("ADAT",   0,  8, eRD_ADAT);
-    addDestination("Analog", 0,  8, eRD_InS0);
+    addDestination("Analog", 0,  2, eRD_InS0);
+    addDestination("Analog", 0,  8, eRD_InS1, 2);
     addDestination("Mixer",  0, 16, eRD_Mixer0);
     addDestination("Mixer",  0,  2, eRD_Mixer1, 16);
-    addDestination("1394",   0, 16, eRD_ATX0);
+    addDestination("1394",   0, 10, eRD_ATX0);
+    addDestination("1394",   0, 10, eRD_ATX1, 10);
     addDestination("Mute",   0,  1, eRD_Muted);
}

Index: src/dice/dice_eap.cpp
===================================================================
--- src/dice/dice_eap.cpp (révision 2019)
+++ src/dice/dice_eap.cpp (copie de travail)
@@ -1021,7 +1021,7 @@
     if(m_eap.m_mixer_readonly) {
         return false;
     }
-    return (row >= 0 && row < m_eap.m_mixer_nb_tx && col >= 0 && col < m_eap.m_mixer_nb_rx);
+    return (row >= 0 && row < m_eap.m_mixer_nb_rx && col >= 0 && col < m_eap.m_mixer_nb_tx);
}

double
@@ -1057,13 +1057,13 @@
int
EAP::Mixer::getRowCount()
{
-    return m_eap.m_mixer_nb_tx;
+    return m_eap.m_mixer_nb_rx;
}

int
EAP::Mixer::getColCount()
{
-    return m_eap.m_mixer_nb_rx;
+    return m_eap.m_mixer_nb_tx;
}

// full map updates are unsupported