Audio of a track is route ever to channels 1 & 2

Hi, sorry for my so many posts,

I wrote this code:

                if (f.exists())
                {
                    tracktion_engine::AudioFile audioFile{f};
                    track->insertWaveClip("xyz", audioFile.getFile(), {{0.0, audioFile.getLength()}, 0.0}, true);
                    auto& transport = edit->getTransport();
                    transport.setCurrentPosition(0.0);
                    transport.play(true);
                }

                track->getOutput().setOutputByName(e.getDeviceManager().getOutputDeviceAt(10)->getName());
                
                DBG(track->getOutput().getOutputName());

In console last line of code I posted print correctly : MADI 17 + 18 , but the song that is in the clip goes always to channel 1&2 of my MadiFace pro. If I turn off channel 1 & 2 from AudioDevice Settings Component signal is auto-routed to 3&4, if i shout down 1&2, 3&4 it’s auto-routed to 5&6 and so on.

Furthermore (this appens also in tracktion_engine example “RecordingDemo”) if I shout down all audio device’s channels the program crashes.

After you call getOutputDeviceAt() can you make sure the Device you get back is enabled. It should be noted there is a difference between tracktion engine devices and juce devices. A juce device would be your MadiFacePro and it would have an array of input and output channels.

A tracktion engine device would correspond to one or a pair of output channels. You need to make sure both are enabled.

Also, after you set the output, make sure Edit::restartPlayback() is getting called.

1 Like

Really thank you @G-Mon fo your replies!

I’ve changed my code in this:
for (int dv = 0; dv < e.getDeviceManager().getNumWaveOutDevices(); ++dv)
{
e.getDeviceManager().getWaveOutDevice(dv)->setEnabled(true); // Attenzione non fidarsi della comboBox di JUCE!
}

        if (e.getDeviceManager().getWaveOutDevice(10)->isEnabled())
        {
            track->getOutput().setOutputByName(e.getDeviceManager().getWaveOutDevice(10)->getName());
            DBG("ci sono");
        }
        
        if (f.exists())
        {
            tracktion_engine::AudioFile audioFile{f};
            track->insertWaveClip("xyz", audioFile.getFile(), {{0.0, audioFile.getLength()}, 0.0}, true);
            auto& transport = edit->getTransport();
            transport.setCurrentPosition(0.0);
            transport.play(true);
        }
        DBG(track->getOutput().getOutputName());

And I think that flag on combo box items of “AudioDeviceSelectorComponent” were confusing me!
Now my signal is routed correctly to output that i chose, but it also pass throw outputs 1&2.

I called before code I’ve posted this two lines:

        e.getDeviceManager().getWaveOutDevice(3)->setEnabled(true);
        e.getDeviceManager().setDefaultWaveOutDevice(3);

and now the signal pass in output that I chose and instead 1&2 it pass in outputs 3&4, why my signal pass always in default wave device as well as going through the output I chose?

Ok! I understood, my track was added inside a folder track, so also folder track was getting the track signal from clip and was routing it to default device!

I leave the posts so someone can benefit from my experience! :slight_smile:

I’m sure other people will have these issues, so it’s good to have the content here if they search. Glad you got it working.

1 Like