Calling ASIO driver functions

I am trying to understand the linkage so I can make calls to an ASIO driver but I don’t understand the linkage. I’ve never looked at how juce handles audio IO before.

What I want to do is call the asio getSamplePoistion which is not available via juce(tjat I can find). Other asio functions are called by Juce like getLatencies. It is called from juce_win32_ASIO.cpp with this call:
asioObject->getLatencies (…);

It seems I should be able to call getSamplePosition this way:
asioObject->getSamplePosition(…) .

That compiles, but does not link. Am I correct in assuming this should work or am I missing something?

Can’t really see how it’d be possible to compile but not link (unless you’re doing something silly that isn’t clear from your description…) Where are you actually trying to add that code?

Typical, not when I try to reporduce it for you it works. I was able to make the call to get sampleposition from within getLatency.

So now I created a new function readSamplePosition in the ASIOAudioIODevice class.

#include <asio.h>
void readSamplePosition(ASIOSamples *sPos, ASIOTimeStamp *tStamp)
asioObject->getSamplePosition(sPos, tStamp);

Now how do I call it from my application. This is where my c++ is weakest.
It seems it should be somthing like:
getSharedAudioDeviceManager.getCurrentDeviceTypeObject()).readSamplePosition(&samps, &tstamp);

But the CurrentDeviceTypeObject is not the correct class object.

What is the proper way to access this?

It’s not something we’d want to add to the audio device’s interface, so the way we normally provide access to specific internal things like this is with a secret function that you can link to if you know its name. It could look something like

void juce_getASIOSamplePosition (AudioIODevice& device, ASIOSamples*, ASIOTimeStamp*)
    jassert (dynamic_cast<ASIOAudioIODevice*> (&device) != nullptr);
    auto& asioDevice = static_cast<ASIOAudioIODevice&> (device);
    asioDevice. getSamplePosition (etc..


This secret function you mentioned. Where would that go? Is there an example of one of these I can look at?

Sorry if this seems like a stupid question but I am missing something and not sure how to ask the right questions to get thinks cleared up in my mind.

Well, it’d have to go in the ASIO code, because it’d obviously have to have access to all the internal stuff.