Hi, I need a help to implement length of audio mp3 file

I dont know where I made a mistake, it doesn't appears on the deck

in DJAudioPlayer.h

void prepareToPlay (int samplesPerBlockExpected, double sampleRate) override;
double rateSampling{ 0.0 };

in DJAudioPlayer.cpp

/** load the file given by the URL for playing */
void DJAudioPlayer::loadURL(juce::URL audioURL)
    juce::AudioFormatReader* reader = formatManager.createReaderFor(audioURL.createInputStream(false));
    if(reader != nullptr)// good file!
        std::unique_ptr<juce::AudioFormatReaderSource> newSource(new juce::AudioFormatReaderSource (reader, true));
        transportSource.setSource(newSource.get(), 0, nullptr, reader->sampleRate);

Thanks for a help

I don’t know what you did to make it appear but in case you are looking for the information, you will get them from the AudioFormatReader:

auto* reader = readerSource->getAudioFormatReader();
auto  lengthInSeconds = reader->lengthInSamples / reader->sampleRate;

Good luck