コード例 #1
0
        internal ScheduledAudioFileRegion GetAudioFileRegion()
        {
            if (alreadyUsed)
            {
                throw new InvalidOperationException("You should not call SetScheduledFileRegion with a previously set region instance");
            }

            IntPtr ptr = IntPtr.Zero;

            if (completionHandler != null)
            {
                handle = GCHandle.Alloc(this);
                ptr    = GCHandle.ToIntPtr(handle);
            }

            var ret = new ScheduledAudioFileRegion {
                TimeStamp = TimeStamp,
                CompletionHandlerUserData = ptr,
                CompletionHandler         = ptr != IntPtr.Zero ? static_ScheduledAudioFileRegionCompletionHandler : null,
                AudioFile    = AudioFile.Handle,
                LoopCount    = LoopCount,
                StartFrame   = StartFrame,
                FramesToPlay = FramesToPlay
            };

            alreadyUsed = true;
            return(ret);
        }
コード例 #2
0
		static void ScheduledAudioFileRegionCallback (IntPtr userData, ref ScheduledAudioFileRegion fileRegion, AudioUnitStatus status)
		{
			if (userData == IntPtr.Zero)
				return;
			
			var handle = GCHandle.FromIntPtr (userData);
			var inst = (AUScheduledAudioFileRegion) handle.Target;
			inst?.completionHandler (inst, status);
		}
コード例 #3
0
        static void ScheduledAudioFileRegionCallback(IntPtr userData, ref ScheduledAudioFileRegion fileRegion, AudioUnitStatus status)
        {
            if (userData == IntPtr.Zero)
            {
                return;
            }

            var handle = GCHandle.FromIntPtr(userData);
            var inst   = (AUScheduledAudioFileRegion)handle.Target;

            inst?.completionHandler(inst, status);
        }
コード例 #4
0
		internal ScheduledAudioFileRegion GetAudioFileRegion ()
		{
			if (alreadyUsed)
				throw new InvalidOperationException ("You should not call SetScheduledFileRegion with a previously set region instance");

			IntPtr ptr = IntPtr.Zero;
			if (completionHandler != null) {
				handle = GCHandle.Alloc (this);
				ptr = GCHandle.ToIntPtr (handle);
			}

			var ret = new ScheduledAudioFileRegion {
				TimeStamp = TimeStamp,
				CompletionHandlerUserData = ptr,
				CompletionHandler = ptr != IntPtr.Zero ? static_ScheduledAudioFileRegionCompletionHandler : null,
				AudioFile = AudioFile.Handle,
				LoopCount = LoopCount,
				StartFrame = StartFrame,
				FramesToPlay = FramesToPlay
			};

			alreadyUsed = true;
			return ret;
		}