示例#1
0
		public void PlayDsp(ChannelIndex channelId, Dsp dsp, bool paused, ref Channel channel)
		{
			if (dsp != null)
			{
				currentResult = Result.Ok;
				IntPtr channelHandle;

				if (channel != null)
				{
					channelHandle = channel.Handle;
				}
				else
				{
					channel = new Channel();
					channelHandle = new IntPtr();
				}

				try
				{
					currentResult = NativeMethods.FMOD_System_PlayDSP(handle, channelId, dsp.Handle, paused, ref channelHandle);
				}
				catch (System.Runtime.InteropServices.ExternalException)
				{
					currentResult = Result.InvalidParameterError;
				}
				
				if (currentResult != Result.Ok)
				{
					channel = new Channel();
					channel.Handle = channelHandle;				
				}
				else
				{
					channel = null;
				}
			}
			else throw new ArgumentNullException("dsp");
		}
示例#2
0
		public Channel GetChannel(int channelId)
		{
			currentResult = Result.Ok;
			IntPtr channelHandle = new IntPtr();
			Channel channel = null;

			try
			{
				currentResult = NativeMethods.FMOD_System_GetChannel(handle, channelId, ref channelHandle);
			}
			catch (System.Runtime.InteropServices.ExternalException)
			{
				currentResult = Result.InvalidParameterError;
			}
			
			if (currentResult == Result.Ok)
			{
				channel = new Channel();
				channel.Handle = channelHandle;				
			}

			return channel;
		}
示例#3
0
		internal void PlaySound(ChannelIndex channelId, Sound sound, bool paused, ref Channel channel)
		{
			if (sound != null)
			{
				currentResult = Result.Ok;
				IntPtr channelHandle;			

				bool wasMuted = false;

				if (channel != null)
				{
					channelHandle = channel.Handle;
					wasMuted = channel.Mute;
				}
				else
				{
					channel = new Channel();
					channelHandle = new IntPtr();
				}

				try
				{
					currentResult = NativeMethods.FMOD_System_PlaySound(handle, channelId, sound.Handle, paused, ref channelHandle);
				}
				catch (System.Runtime.InteropServices.ExternalException)
				{
					currentResult = Result.InvalidParameterError;
				}
				
				if (currentResult == Result.Ok)
				{
					channel.Handle = channelHandle;
					
					if (wasMuted)
					{
						channel.Mute = true;
					}
				}
				else
				{
					channel = null;
				}
			}
		}