Help with BufferPlayerNode in CLion

Cinder newbie here. Trying to figure out why my BufferPlayerNode isn’t working properly. Everything compiles and the GainNodeRef has the correct volume (1.0f) but I cannot hear any sounds playing from my computer :frowning:

Here’s the code snippet:

    auto ctx = audio::Context::master();
    audio::SourceFileRef source_file = audio::load(loadAsset("tanpura_C.mp3"), ctx->getSampleRate());

    //create BufferPlayerNode from file
    buffer_player = ctx->makeNode(new audio::BufferPlayerNode());
    buffer_player->loadBuffer(source_file);

    //create GainNode for volume control, set to max volume
    audio::GainNodeRef gain = ctx->makeNode(new audio::GainNode(1.0f));

    // Connect player components to audio graph
    buffer_player >> gain >> ctx->getOutput();

    std::cout << gain->getValue();
    ctx->enable();
    buffer_player->start();

Could anyone provide me with pointers about where I could be going wrong here? Thank you so much!!

I’m using Clion 2021.1.1 on MacOS Catalina if that helps.

Just tested your code and it worked fine for me, so I guess that points to either your specific sound setup or your mp3 file itself. Do you have any exotic outputs on your machine or is it all standard?

Okay so turns out I had the code in the wrong target portion, I was able to get it to work. Thank you so much!