Issue simply write to output buffer

Hello y’all,
I’m currently learning how to use juce and it’s whole features, and have done the whole bunch of tutorials presents on the website. As I wanted to start making thinks by myself, I tried to create a metronome that could play sound on a regular time basis.
After some struggles, I managed to get something that works, but unfortunately, only with syn wave. As I send the bufferToFill from the getNextAudioBlock function to another one for it to be fullfilled, no sound output. (I stole this part of the code from a tutorial that works on his own, so I don’t understand anything…). Here the code executed when trying to play the sample :

	juce::AudioFormatManager formatManager;
	std::unique_ptr<juce::AudioFormatReaderSource> readerSource;
	std::unique_ptr<juce::AudioFormatReaderSource> readerSource2;
	juce::AudioTransportSource transportSource;
	juce::AudioTransportSource transportSource2;

//two transport source because two differents sounds one for the hard click and the other for the slow one

	void openButtonDownClicked()
	{
		chooser = std::make_unique<juce::FileChooser>("Choisis un son en Wav pour le milieu de mesure mon reuf",
			juce::File{},
			"*.wav");
		auto chooserFlags = juce::FileBrowserComponent::openMode
			| juce::FileBrowserComponent::canSelectFiles;

		chooser->launchAsync(chooserFlags, [this](const FileChooser& fc)
		{
			auto file = fc.getResult();

			if (file != File{})
			{
				auto* reader = formatManager.createReaderFor(file);

				if (reader != nullptr)
				{
					auto newSource = std::make_unique<juce::AudioFormatReaderSource>(reader, true);
					transportSource2.setSource(newSource.get(), 0, nullptr, reader->sampleRate);
					readerSource2.reset(newSource.release());
				}
			}
		});
	}

//This is the function used to load the files I think that this one works correctly


	void getNextAudioBlock(const juce::AudioSourceChannelInfo& bufferToFill) override
	{
		if (AudioSample.getToggleState() == true)
		{
			playsoundsample(bufferToFill);
			return;
		}
//... During execution, it greatly goes there so I think It's okay

	void playsoundsample(const juce::AudioSourceChannelInfo& bufferToFill) 
	{
		if (readerSource.get() == nullptr)
		{
			bufferToFill.clearActiveBufferRegion();
			return;
		}

		transportSource.getNextAudioBlock(bufferToFill);
		return;
	}
//then I try to write in the buffer and nothing happen...

If anybody has any clue, even little, I’ll be very greatefull !

You are using two transport sources, to playback two audio files.
I don’t think that will work as intended.
TransportSources are roughly a class to playback a file from disk.

What I would do, is to load the two audio files into two audiobuffer members at construction (or when loading the files) using for instance your

auto* reader....

These can then be mixed with the supplied buffer in your getNextAudioBlock at the right timing.