/// <inheritdoc/> public void RegisterImportersAndProcessors(IEnumerable <Assembly> additionalAssemblies) { Contract.EnsureNot(registered, UltravioletStrings.ContentHandlersAlreadyRegistered); var asmUltravioletCore = typeof(UltravioletContext).Assembly; var asmUltravioletImpl = Ultraviolet.GetType().Assembly; var asmUltravioletPlatform = Ultraviolet.GetPlatform().GetType().Assembly; var asmUltravioletContent = Ultraviolet.GetContent().GetType().Assembly; var asmUltravioletGraphics = Ultraviolet.GetGraphics().GetType().Assembly; var asmUltravioletAudio = Ultraviolet.GetAudio().GetType().Assembly; var asmUltravioletInput = Ultraviolet.GetInput().GetType().Assembly; var asmUltravioletUI = Ultraviolet.GetUI().GetType().Assembly; var assemblies = new[] { asmUltravioletCore, asmUltravioletImpl, asmUltravioletPlatform, asmUltravioletContent, asmUltravioletGraphics, asmUltravioletAudio, asmUltravioletInput, asmUltravioletUI }.Union(additionalAssemblies ?? Enumerable.Empty <Assembly>()).Where(x => x != null).Distinct(); foreach (var asm in assemblies) { importers.RegisterAssembly(asm); processors.RegisterAssembly(asm); } registered = true; }
/// <inheritdoc/> public override void Play() { Contract.EnsureNotDisposed(this, Disposed); var result = default(FMOD_RESULT); var system = ((FMODUltravioletAudio)Ultraviolet.GetAudio()).System; var channel = default(FMOD_CHANNEL *); var channelgroup = ChannelGroup; result = FMOD_System_PlaySound(system, sound, channelgroup, false, &channel); if (result != FMOD_OK) { throw new FMODException(result); } }
/// <inheritdoc/> public override void Play(Single volume, Single pitch, Single pan) { Contract.EnsureNotDisposed(this, Disposed); var result = default(FMOD_RESULT); var system = ((FMODUltravioletAudio)Ultraviolet.GetAudio()).System; var channel = default(FMOD_CHANNEL *); var channelgroup = ChannelGroup; result = FMOD_System_PlaySound(system, sound, channelgroup, true, &channel); if (result != FMOD_OK) { throw new FMODException(result); } result = FMOD_Channel_SetVolume(channel, MathUtil.Clamp(volume, 0f, 1f)); if (result != FMOD_OK) { throw new FMODException(result); } result = FMOD_Channel_SetPitch(channel, 1f + MathUtil.Clamp(volume, -1f, 1f)); if (result != FMOD_OK) { throw new FMODException(result); } result = FMOD_Channel_SetPan(channel, MathUtil.Clamp(volume, -1f, 1f)); if (result != FMOD_OK) { throw new FMODException(result); } result = FMOD_Channel_SetPaused(channel, false); if (result != FMOD_OK) { throw new FMODException(result); } }