Class AVMusicTrack

  • All Implemented Interfaces:
    NSObject

    public class AVMusicTrack
    extends NSObject
    AVMusicTrack A collection of music events which will be sent to a given destination, and which can be offset, muted, etc. independently of events in other tracks. AVMusicTrack is not a container of AVMusicEvents - it will not hold references to AVMusicEvents that are added, so an application should maintain its own if it is desired. API-Since: 9.0
    • Constructor Detail

      • AVMusicTrack

        protected AVMusicTrack​(org.moe.natj.general.Pointer peer)
    • Method Detail

      • accessInstanceVariablesDirectly

        public static boolean accessInstanceVariablesDirectly()
      • allocWithZone

        public static AVMusicTrack allocWithZone​(org.moe.natj.general.ptr.VoidPtr zone)
      • automaticallyNotifiesObserversForKey

        public static boolean automaticallyNotifiesObserversForKey​(@NotNull
                                                                   @NotNull java.lang.String key)
      • cancelPreviousPerformRequestsWithTarget

        public static void cancelPreviousPerformRequestsWithTarget​(@NotNull
                                                                   @NotNull java.lang.Object aTarget)
      • cancelPreviousPerformRequestsWithTargetSelectorObject

        public static void cancelPreviousPerformRequestsWithTargetSelectorObject​(@NotNull
                                                                                 @NotNull java.lang.Object aTarget,
                                                                                 @NotNull
                                                                                 @NotNull org.moe.natj.objc.SEL aSelector,
                                                                                 @Nullable
                                                                                 @Nullable java.lang.Object anArgument)
      • classFallbacksForKeyedArchiver

        @NotNull
        public static @NotNull NSArray<java.lang.String> classFallbacksForKeyedArchiver()
      • classForKeyedUnarchiver

        @NotNull
        public static @NotNull org.moe.natj.objc.Class classForKeyedUnarchiver()
      • debugDescription_static

        public static java.lang.String debugDescription_static()
      • description_static

        public static java.lang.String description_static()
      • destinationAudioUnit

        @Nullable
        public @Nullable AVAudioUnit destinationAudioUnit()
        [@property] destinationAudioUnit The AVAudioUnit which will receive the track's events This is mutually exclusive with setting a destination MIDIEndpoint. The AU must already be attached to an audio engine, and the track must be part of the AVAudioSequencer associated with that engine. When playing, the track will send its events to that AVAudioUnit. The destination AU cannot be changed while the track's sequence is playing.
      • destinationMIDIEndpoint

        public int destinationMIDIEndpoint()
      • hash_static

        public static long hash_static()
      • instanceMethodSignatureForSelector

        public static NSMethodSignature instanceMethodSignatureForSelector​(org.moe.natj.objc.SEL aSelector)
      • instancesRespondToSelector

        public static boolean instancesRespondToSelector​(org.moe.natj.objc.SEL aSelector)
      • isLoopingEnabled

        public boolean isLoopingEnabled()
        [@property] loopingEnabled Determines whether or not the track is looped. If loopRange has not been set, the full track will be looped.
      • isMuted

        public boolean isMuted()
        [@property] muted Whether the track is muted
      • isSoloed

        public boolean isSoloed()
        [@property] soloed Whether the track is soloed
      • isSubclassOfClass

        public static boolean isSubclassOfClass​(org.moe.natj.objc.Class aClass)
      • keyPathsForValuesAffectingValueForKey

        @NotNull
        public static @NotNull NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey​(@NotNull
                                                                                             @NotNull java.lang.String key)
      • lengthInBeats

        public double lengthInBeats()
        [@property] lengthInBeats The total duration of the track in beats This will return the beat of the last event in the track plus any additional time that may be needed for fading out of ending notes or round a loop point to musical bar, etc. If this has not been set by the user, the track length will always be adjusted to the end of the last active event in a track and is adjusted dynamically as events are added or removed. The property will return the maximum of the user-set track length, or the calculated length.
      • lengthInSeconds

        public double lengthInSeconds()
        [@property] lengthInSeconds The total duration of the track in seconds This will return time of the last event in the track plus any additional time that may be needed for fading out of ending notes or round a loop point to musical bar, etc. If this has not been set by the user, the track length will always be adjusted to the end of the last active event in a track and is adjusted dynamically as events are added or removed. The property will return the maximum of the user-set track length, or the calculated length.
      • loopRange

        public AVBeatRange loopRange()
        [@property] loopRange The timestamp range in beats for the loop The loop is set by specifying its beat range.
      • numberOfLoops

        public long numberOfLoops()
        [@property] numberOfLoops The number of times that the track's loop will repeat If set to AVMusicTrackLoopCountForever, the track will loop forever. Otherwise, legal values start with 1.
      • offsetTime

        public double offsetTime()
        [@property] offsetTime Offset the track's start time to the specified time in beats By default this value is zero.
      • resolveClassMethod

        public static boolean resolveClassMethod​(org.moe.natj.objc.SEL sel)
      • resolveInstanceMethod

        public static boolean resolveInstanceMethod​(org.moe.natj.objc.SEL sel)
      • setDestinationAudioUnit

        public void setDestinationAudioUnit​(@Nullable
                                            @Nullable AVAudioUnit value)
        [@property] destinationAudioUnit The AVAudioUnit which will receive the track's events This is mutually exclusive with setting a destination MIDIEndpoint. The AU must already be attached to an audio engine, and the track must be part of the AVAudioSequencer associated with that engine. When playing, the track will send its events to that AVAudioUnit. The destination AU cannot be changed while the track's sequence is playing.
      • setDestinationMIDIEndpoint

        public void setDestinationMIDIEndpoint​(int value)
      • setLengthInBeats

        public void setLengthInBeats​(double value)
        [@property] lengthInBeats The total duration of the track in beats This will return the beat of the last event in the track plus any additional time that may be needed for fading out of ending notes or round a loop point to musical bar, etc. If this has not been set by the user, the track length will always be adjusted to the end of the last active event in a track and is adjusted dynamically as events are added or removed. The property will return the maximum of the user-set track length, or the calculated length.
      • setLengthInSeconds

        public void setLengthInSeconds​(double value)
        [@property] lengthInSeconds The total duration of the track in seconds This will return time of the last event in the track plus any additional time that may be needed for fading out of ending notes or round a loop point to musical bar, etc. If this has not been set by the user, the track length will always be adjusted to the end of the last active event in a track and is adjusted dynamically as events are added or removed. The property will return the maximum of the user-set track length, or the calculated length.
      • setLoopRange

        public void setLoopRange​(AVBeatRange value)
        [@property] loopRange The timestamp range in beats for the loop The loop is set by specifying its beat range.
      • setLoopingEnabled

        public void setLoopingEnabled​(boolean value)
        [@property] loopingEnabled Determines whether or not the track is looped. If loopRange has not been set, the full track will be looped.
      • setMuted

        public void setMuted​(boolean value)
        [@property] muted Whether the track is muted
      • setNumberOfLoops

        public void setNumberOfLoops​(long value)
        [@property] numberOfLoops The number of times that the track's loop will repeat If set to AVMusicTrackLoopCountForever, the track will loop forever. Otherwise, legal values start with 1.
      • setOffsetTime

        public void setOffsetTime​(double value)
        [@property] offsetTime Offset the track's start time to the specified time in beats By default this value is zero.
      • setSoloed

        public void setSoloed​(boolean value)
        [@property] soloed Whether the track is soloed
      • setVersion_static

        public static void setVersion_static​(long aVersion)
      • superclass_static

        public static org.moe.natj.objc.Class superclass_static()
      • timeResolution

        public long timeResolution()
        [@property] timeResolution The time resolution value for the sequence, in ticks (pulses) per quarter note (PPQN) If a MIDI file was used to construct the containing sequence, the resolution will be what was in the file. If you want to keep a time resolution when writing a new file, you can retrieve this value and then specify it when calling -[AVAudioSequencer writeToFile:flags:withResolution]. It has no direct bearing on the rendering or notion of time of the sequence itself, just its representation in MIDI files. By default this is set to either 480 if the sequence was created manually, or a value based on what was in a MIDI file if the sequence was created from a MIDI file. This can only be retrieved from the tempo track.
      • version_static

        public static long version_static()
      • addEventAtBeat

        public void addEventAtBeat​(@NotNull
                                   @NotNull AVMusicEvent event,
                                   double beat)
        addAvent:atBeat Adds an AVMusicEvent's contents to a track at the specified AVMusicTimeStamp. Because event contents are copied into the track, the same event may be added multiple times at different timestamps. There are restrictions on which AVMusicEvent subclasses may be added to different tracks: - Only AVExtendedTempoEvents and AVMIDIMetaEvents with certain AVMIDIMetaEventTypes can be added to an AVMusicSequence's tempo track (see AVMIDIMetaEvent). - AVParameterEvents can only be added to automation tracks (see AVParameterEvent). - All other event subclasses cannot be added to tempo or automation tracks.
        Parameters:
        event - the event to be added
        beat - the AVMusicTimeStamp
      • clearEventsInRange

        public void clearEventsInRange​(AVBeatRange range)
        clearEventsInRange: Removes all events in the given beat range, erasing that portion of the AVMusicTrack. All events outside of the specified range left unmodified.
        Parameters:
        range - the range of beats. Must be a valid AVBeatRange.
      • copyAndMergeEventsInRangeFromTrackMergeAtBeat

        public void copyAndMergeEventsInRangeFromTrackMergeAtBeat​(AVBeatRange range,
                                                                  @NotNull
                                                                  @NotNull AVMusicTrack sourceTrack,
                                                                  double mergeStartBeat)
        copyAndMergeEventsInRange:fromTrack:mergeAtBeat Copies all events in the given beat range from the specified AVMusicTrack, merging them into the current AVMusicTrack. All events originally at or past mergeStartBeat will be left unmodified. Copying events from track to track follows the same type-exclusion rules as adding events: The operation will generate an exception.
        Parameters:
        range - the range of beats. Must be a valid AVBeatRange.
        sourceTrack - the AVMusicTrack to copy the events from.
        insertStartBeat - the start beat at which the copied events should be merged.
      • copyEventsInRangeFromTrackInsertAtBeat

        public void copyEventsInRangeFromTrackInsertAtBeat​(AVBeatRange range,
                                                           @NotNull
                                                           @NotNull AVMusicTrack sourceTrack,
                                                           double insertStartBeat)
        copyEventsInRange:fromTrack:insertAtBeat Copies all events in the given beat range from the specified AVMusicTrack, splicing them into the current AVMusicTrack. All events originally at or past insertStartBeat will be shifted forward by the duration of the copied-in range.
        Parameters:
        range - the range of beats. Must be a valid AVBeatRange.
        sourceTrack - the AVMusicTrack to copy the events from.
        insertStartBeat - the start beat at which the copied events should be spliced in.
      • cutEventsInRange

        public void cutEventsInRange​(AVBeatRange range)
        cutEventsInRange: Removes all events in the given beat range, splicing out that portion of the AVMusicTrack. All events past the end of the specified range will be shifted backward by the duration of the range.
        Parameters:
        range - the range of beats. Must be a valid AVBeatRange.
      • enumerateEventsInRangeUsingBlock

        public void enumerateEventsInRangeUsingBlock​(AVBeatRange range,
                                                     @NotNull
                                                     @NotNull AVMusicTrack.Block_enumerateEventsInRangeUsingBlock block)
        enumerateEventsInRange:usingBlock: Iterates through the AVMusicEvents within the AVMusicTrack whose timestamps fit within the range, calling the block for each. Each event returned via the block should be examined using `NSObject(isKindOfClass:)` to determine its subclass and then cast and accessed/edited accordingly. The iteration may continue after removing an event. The event objects returned via the block will not be the same instances which were added to the AVMusicTrack, though their contents will be identical.
        Parameters:
        block - the AVMusicEventEnumerationBlock to call for each event.
      • moveEventsInRangeByAmount

        public void moveEventsInRangeByAmount​(AVBeatRange range,
                                              double beatAmount)
        moveEventsInRange:byAmount Shift the beat location of all events in the given beat range by the amount specified.
        Parameters:
        range - the range of beats. Must be a valid AVBeatRange.
        beatAmount - the amount in beats to shift each event. The amount may be positive or negative.
      • setUsesAutomatedParameters

        public void setUsesAutomatedParameters​(boolean value)
        [@property] usesAutomatedParameters Indicates whether the track is an automation track. If set to YES, this can be used to contain, parameter automation events, exclusively. Adding any other event types will generate exceptions. If a track already contains non-parameter events, setting this to YES will generate an exception.
      • usesAutomatedParameters

        public boolean usesAutomatedParameters()
        [@property] usesAutomatedParameters Indicates whether the track is an automation track. If set to YES, this can be used to contain, parameter automation events, exclusively. Adding any other event types will generate exceptions. If a track already contains non-parameter events, setting this to YES will generate an exception.
      • useStoredAccessor

        @Deprecated
        public static boolean useStoredAccessor()
        Deprecated.