Here is my interpretation of it:
Scene is managed by SceneList. Scene creates ClipSlots to all available AudioTracks. A Clip lives in a ClipSlot and is managed by the ClipSlotList. An AudioTrack owns the ClipSlotList. If I want to launch a clip, I should use the LaunchHandle thats belongs to the Clip.
No, that’s correct.
The MonotonicBeat is the point in the future that you want to launch it though. If you want to launch it immediately, just pass an empty optional i.e. play ({}).
Although a MonotonicBeat (0_bp) will probably do the same thing as 0_bp is likely to be in the past and hence launched immediately.
It is a bit early to rely on the exact APIs and behaviour though. It won’t be fixed until we release v3.0 of the Engine.
Also note that the feature/launcher branch is a technical preview so can’t be commercially licensed yet.
Thanks for the hint @dave96!
In my code example the ->getClip() doesn’t work correct. I’m getting an error JUCE Message Thread (1): EXC_BAD_ACCESS (code=1, address=0x0)
Should I call something between ->setClip() and ->getClip ?
Yes, it works better. But I have another issue here:
void ClipSlot::setClip (Clip* c)
{
if (c == nullptr)
return;
if (auto existingClip = getClip())
existingClip->removeFromParent();
jassert (findClipForID (c->itemID) == nullptr); <== No matching function for call to 'findClipForID'
auto um = c->getUndoManager();
c->state.getParent().removeChild (c->state, um);
state.addChild (c->state, -1, um);
}
It works when I comment this out: jassert (findClipForID (c->itemID) == nullptr);
Now I’m playing around with the LaunchHandle. If I start a clip (while the transport is playing) I hear a very short part (like a short click sound) of it. My approach is to launch and stop a clip with a quantisation of 1 bar. The clip should loop until I stop it. This is my code:
jassert (findClipForID (c->itemID) == nullptr); <== No matching function for call to 'findClipForID
I thought this was fixed? Can you grab the latest and try again please?
tracktion::MonotonicBeat( {} ) means, “as soon as possible”, i.e. not in the future so it sounds like you’re starting and stopping it straight away.
You probably want to look at Edit::getLaunchQuantisation()
@dave96 Congratulation to the Tracktion 13 launch! The new clip launcher works well!
I got the latest version but didn’t help:
As I mentioned, it works for me if I comment the line out.
I think I figure it out how the new tracktion::MonotonicBeat works. It’s like a parallel beat based timeline - right? And the clip launcher syncs the clip start and stop to it.
With this code I can synced launch / stop the clip with 1 bar quantisation (4_bd) :
“Loop” is just if the loop length is non-zero.
If you set the loop length in beats, you also need to enable “auto-tempo”.
Sorry I’m being slow to respond but the clip launcher branch isn’t really ready for public consumption yet so I can’t really prioritise it this soon after a major app launch I’m afraid.
If I understand you correctly, does ‘non-zero’ mean a value greater than zero?.
My code ( stepClip->setLoopRangeBeats( {0_bp, 4_bp} ); ) should work - right?
I can’t set up “auto-tempo” for StepClip. I only found it for AudioClipBase.
No worries about the delayed response, I’m grateful for your insight and guidance.
I schedule a stop clip for every clip in the ClipSlotList before launching another clip in the slot list. Or is there a build in function for this clip launch behaviour?
No that’s what we do currently. You could optimise by keeping track of all the playing or queued clips but it wouldn’t be much more efficient.
Or is there a build in function for this clip launch behaviour?
What you’ve got will probably only work once when play starts from the beginning. The MonotonicBeat continues during playback so you need to find the “current” MonotonicBeat and use that as a reference. In Waveform what we do is get the current sync point from the current sync point from the EditPlaybackContext::getSyncPoint(), find the next BeatPosition to launch at using LaunchQuantisation and SyncPoint::beat. Find the duration number of beats between the current beat position and the launch position, then add that on to the SyncPoint::MonotonicBeat to find out where to launch/stop the clips.
It seams there was little bit refactoring in case of targeting a track to send midi data.
In my scenario we have two audio tracks and I want to switch between this tracks and send send midi notes via GUI to the selected one. But I can reach audioTrackB with midi data only. Did I miss something @dave96 ?
Is your input armed? We added a new input monitoring mode “auto”, where midi only processed when input armed. Either arm your input or set monitor mode to “on”.