diff --git a/src/detail/auv2/process.cpp b/src/detail/auv2/process.cpp index 845c1f59..7aac617a 100644 --- a/src/detail/auv2/process.cpp +++ b/src/detail/auv2/process.cpp @@ -180,6 +180,7 @@ void ProcessAdapter::process(ProcessData& data) { // TODO: transportchanged flag? _transport.flags |= data._isPlaying ? CLAP_TRANSPORT_IS_PLAYING : 0; + _transport.flags |= data._isRecording ? CLAP_TRANSPORT_IS_RECORDING : 0; // CLAP_TRANSPORT_IS_RECORDING can not be retrieved from this data block _transport.flags |= data._isLooping ? CLAP_TRANSPORT_IS_LOOP_ACTIVE : 0; // CLAP_TRANSPORT_IS_RECORDING can not be retrieved from the AudioUnit API diff --git a/src/detail/auv2/process.h b/src/detail/auv2/process.h index 41d60773..636761af 100644 --- a/src/detail/auv2/process.h +++ b/src/detail/auv2/process.h @@ -53,6 +53,7 @@ struct ProcessData Boolean _isPlaying; Boolean _transportChanged; Boolean _isLooping; + Boolean _isRecording; // -------------- bool _AUbeatAndTempoValid; // true if: diff --git a/src/wrapasauv2.cpp b/src/wrapasauv2.cpp index 8df41684..9e4e639f 100644 --- a/src/wrapasauv2.cpp +++ b/src/wrapasauv2.cpp @@ -920,19 +920,29 @@ OSStatus WrapAsAUV2::Render(AudioUnitRenderActionFlags& inFlags, const AudioTime // retrieve musical information for this render block - // TODO: clarify how we can get transportStateProc2 - // mHostCallbackInfo.transportStateProc2 -#if 1 - data._AUtransportValid = - (noErr == CallHostTransportState(&data._isPlaying, &data._transportChanged, - &data._currentSongPosInSeconds, &data._isLooping, - &data._cycleStart, &data._cycleEnd)); + auto hcb = GetHostCallbackInfo(); + if (hcb.transportStateProc2) + { + data._AUtransportValid = + (noErr == (hcb.transportStateProc2)(hcb.hostUserData, &data._isPlaying, &data._isRecording, + &data._transportChanged, &data._currentSongPosInSeconds, + &data._isLooping, &data._cycleStart, &data._cycleEnd)); + } + else + { + data._isRecording = FALSE; + + data._AUtransportValid = + (noErr == CallHostTransportState(&data._isPlaying, &data._transportChanged, + &data._currentSongPosInSeconds, &data._isLooping, + &data._cycleStart, &data._cycleEnd)); + } + data._currentSongPosInSeconds /= std::max(_plugin->getSampleRate(), 1.0); // just in case data._AUbeatAndTempoValid = (noErr == CallHostBeatAndTempo(&data._beat, &data._tempo)); data._AUmusicalTimeValid = (noErr == CallHostMusicalTimeLocation(&data._offsetToNextBeat, &data._musicalNumerator, &data._musicalDenominator, &data._currentDownBeat)); -#endif // Get output buffer list and extract the i/o buffer pointers. // The loop is done so that an arbitrary number of output busses // with an arbitrary number of output channels is mapped onto a