public OutputNode(int x, int y) : base("Heightmap", new SerializableRect(x, y, 300, 400)) { CreateInputs(1); hasOutput = false; previewSize = 256; this.type = lastType = OUTPUTTYPE.HEIGHTMAP; }
public bool isEnableWasapi() { bool result = false; OUTPUTTYPE outputtype = OUTPUTTYPE.NOSOUND; system.getOutput(ref outputtype); if (outputtype == OUTPUTTYPE.WASAPI) { result = true; } return(result); }
private static extern RESULT FMOD5_System_GetOutput (IntPtr system, out OUTPUTTYPE output);
// Pre-init functions. public RESULT setOutput (OUTPUTTYPE output) { return FMOD5_System_SetOutput(rawPtr, output); }
/*public static FMOD.Studio.System initStudioSystem(bool enableLiveUpdate = false, OUTPUTTYPE outputType = OUTPUTTYPE.AUTODETECT, int driverIndex = 0) * { * var initFlags = enableLiveUpdate ? FMOD.Studio.INITFLAGS.LIVEUPDATE : FMOD.Studio.INITFLAGS.NORMAL; * * Console.WriteLine("FMODSystem: Initializing"); * // Create the Studio System object. * FMOD.Studio.System system; * checkResult(FMOD.Studio.System.create(out system)); * FMOD.System coreSystem; * system.getCoreSystem(out coreSystem); * coreSystem.setOutput(outputType); * coreSystem.setDriver(driverIndex); * // Initialize FMOD Studio, which will also initialize FMOD Core * checkResult(system.initialize(512, initFlags, FMOD.INITFLAGS.NORMAL, IntPtr.Zero)); * * return system; * }*/ public static FMOD.Studio.System initStudioSystem(bool enableLiveUpdate = false, OUTPUTTYPE outputType = OUTPUTTYPE.AUTODETECT, int driverIndex = 0, int sampleRate = 48000, SPEAKERMODE speakerMode = SPEAKERMODE.DEFAULT, int numRawSpeakers = 0, uint bufferLength = 1024, int numBuffers = 4) { var initFlags = enableLiveUpdate ? FMOD.Studio.INITFLAGS.LIVEUPDATE : FMOD.Studio.INITFLAGS.NORMAL; Console.WriteLine("FMODSystem: Initializing"); // Create the Studio System object. FMOD.Studio.System system; checkResult(FMOD.Studio.System.create(out system)); FMOD.System coreSystem; system.getCoreSystem(out coreSystem); coreSystem.setOutput(outputType); coreSystem.setDriver(driverIndex); coreSystem.setSoftwareFormat(sampleRate, speakerMode, numRawSpeakers); coreSystem.setDSPBufferSize(bufferLength, numBuffers); // Initialize FMOD Studio, which will also initialize FMOD Core checkResult(system.initialize(512, initFlags, FMOD.INITFLAGS.NORMAL, IntPtr.Zero)); return(system); }
private static extern RESULT FMOD5_System_GetOutput(IntPtr system, out OUTPUTTYPE output);
public RESULT getOutput(out OUTPUTTYPE output) { return(System.FMOD5_System_GetOutput(this.rawPtr, out output)); }
public RESULT getOutput(out OUTPUTTYPE output) { return(FMOD5_System_GetOutput(handle, out output)); }
// Pre-init functions. public RESULT setOutput(OUTPUTTYPE output) { return FMOD_System_SetOutput(systemraw, output); }
/// <summary> /// Initialize the FMOD sound system. /// </summary> private void InitFMOD() { try { FMODExec(Factory.System_Create(out system)); uint version = 0; FMODExec(system.getVersion(out version)); if (version < VERSION.number) { throw new MediaException("You are using an old version of FMOD " + version.ToString("X") + ". This program requires " + VERSION.number.ToString("X") + "."); } // Try to detect soud system used if (Environment.OSVersion.Platform == PlatformID.Unix || Environment.OSVersion.Platform == PlatformID.MacOSX) { bool audioOK = false; var res = system.setOutput(OUTPUTTYPE.COREAUDIO); if (res == RESULT.OK) { audioOK = true; } if (!audioOK) { res = system.setOutput(OUTPUTTYPE.PULSEAUDIO); if (res == RESULT.OK) { audioOK = true; } } if (!audioOK) { res = system.setOutput(OUTPUTTYPE.ALSA); if (res == RESULT.OK) { audioOK = true; } } if (!audioOK) { res = system.setOutput(OUTPUTTYPE.AUTODETECT); if (res == RESULT.OK) { audioOK = true; } } } OUTPUTTYPE outputType = OUTPUTTYPE.UNKNOWN; FMODExec(system.getOutput(out outputType)); // *TODO: Investigate if this all is still needed under FMODStudio #if false // The user has the 'Acceleration' slider set to off, which // is really bad for latency. At 48khz, the latency between // issuing an fmod command and hearing it will now be about 213ms. if ((caps & FMOD.CAPS.HARDWARE_EMULATED) == FMOD.CAPS.HARDWARE_EMULATED) { FMODExec(system.setDSPBufferSize(1024, 10)); } try { StringBuilder name = new StringBuilder(128); // Get driver information so we can check for a wierd one. Guid guid = new Guid(); FMODExec(system.getDriverInfo(0, name, 128, out guid)); // Sigmatel sound devices crackle for some reason if the format is pcm 16bit. // pcm floating point output seems to solve it. if (name.ToString().IndexOf("SigmaTel") != -1) { FMODExec(system.setSoftwareFormat( 48000, FMOD.SOUND_FORMAT.PCMFLOAT, 0, 0, FMOD.DSP_RESAMPLER.LINEAR) ); } } catch {} #endif // FMODExec(system.setDSPBufferSize(1024, 10)); // Try to initialize with all those settings, and Max 32 channels. RESULT result = system.init(32, INITFLAGS.NORMAL, (IntPtr)null); if (result != RESULT.OK) { throw(new Exception(result.ToString())); } // Set real-world effect scales. FMODExec(system.set3DSettings( 1.0f, // Doppler scale 1.0f, // Distance scale is meters 1.0f) // Rolloff factor ); SoundSystemAvailable = true; Logger.Log("Initialized FMOD Ex: " + outputType, Helpers.LogLevel.Debug); } catch (Exception ex) { Logger.Log("Failed to initialize the sound system: " + ex, Helpers.LogLevel.Warning); } }
private RESULT Initialize() { initializedSuccessfully = false; RESULT rESULT = RESULT.OK; RESULT rESULT2 = RESULT.OK; Settings settings = Settings.Instance; fmodPlatform = RuntimeUtils.GetCurrentPlatform(); int sampleRate = settings.GetSampleRate(fmodPlatform); int num = Math.Min(settings.GetRealChannels(fmodPlatform), 256); int virtualChannels = settings.GetVirtualChannels(fmodPlatform); SPEAKERMODE speakerMode = (SPEAKERMODE)settings.GetSpeakerMode(fmodPlatform); OUTPUTTYPE output = OUTPUTTYPE.AUTODETECT; FMOD.ADVANCEDSETTINGS settings2 = default(FMOD.ADVANCEDSETTINGS); settings2.randomSeed = (uint)DateTime.Now.Ticks; settings2.maxVorbisCodecs = num; FMOD.Studio.INITFLAGS iNITFLAGS = FMOD.Studio.INITFLAGS.DEFERRED_CALLBACKS; if (settings.IsLiveUpdateEnabled(fmodPlatform)) { iNITFLAGS |= FMOD.Studio.INITFLAGS.LIVEUPDATE; } while (true) { rESULT = FMOD.Studio.System.create(out studioSystem); CheckInitResult(rESULT, "FMOD.Studio.System.create"); rESULT = studioSystem.getLowLevelSystem(out lowlevelSystem); CheckInitResult(rESULT, "FMOD.Studio.System.getLowLevelSystem"); rESULT = lowlevelSystem.setOutput(output); CheckInitResult(rESULT, "FMOD.System.setOutput"); rESULT = lowlevelSystem.setSoftwareChannels(num); CheckInitResult(rESULT, "FMOD.System.setSoftwareChannels"); rESULT = lowlevelSystem.setSoftwareFormat(sampleRate, speakerMode, 0); CheckInitResult(rESULT, "FMOD.System.setSoftwareFormat"); rESULT = lowlevelSystem.setAdvancedSettings(ref settings2); CheckInitResult(rESULT, "FMOD.System.setAdvancedSettings"); rESULT = studioSystem.initialize(virtualChannels, iNITFLAGS, FMOD.INITFLAGS.NORMAL, IntPtr.Zero); if (rESULT != 0 && rESULT2 == RESULT.OK) { rESULT2 = rESULT; output = OUTPUTTYPE.NOSOUND; Debug.LogWarningFormat("FMOD Studio: Studio::System::initialize returned {0}, defaulting to no-sound mode.", rESULT.ToString()); } else { CheckInitResult(rESULT, "Studio::System::initialize"); if ((iNITFLAGS & FMOD.Studio.INITFLAGS.LIVEUPDATE) == FMOD.Studio.INITFLAGS.NORMAL) { break; } studioSystem.flushCommands(); rESULT = studioSystem.update(); if (rESULT != RESULT.ERR_NET_SOCKET_ERROR) { break; } iNITFLAGS = (FMOD.Studio.INITFLAGS)((int)iNITFLAGS & -2); Debug.LogWarning("FMOD Studio: Cannot open network port for Live Update (in-use), restarting with Live Update disabled."); rESULT = studioSystem.release(); CheckInitResult(rESULT, "FMOD.Studio.System.Release"); } } LoadPlugins(settings); LoadBanks(settings); initializedSuccessfully = (rESULT == RESULT.OK); return(rESULT2); }
public System(bool enableLiveUpdate = false, OUTPUTTYPE outputType = OUTPUTTYPE.AUTODETECT, int driverIndex = 0, int sampleRate = 48000, SPEAKERMODE speakerMode = SPEAKERMODE.DEFAULT, int numRawSpeakers = 0, uint bufferLength = 1024, int numBuffers = 4) { Ready = false; _system = Utilities.initStudioSystem(enableLiveUpdate, outputType, driverIndex, sampleRate, speakerMode, numRawSpeakers, bufferLength, numBuffers); }
public RESULT getOutput (out OUTPUTTYPE output) { return FMOD_System_GetOutput(rawPtr, out output); }
public RESULT getOutput(out OUTPUTTYPE output) { return System.FMOD5_System_GetOutput(this.rawPtr, out output); }
public RESULT getOutput(ref OUTPUTTYPE output) { return FMOD_System_GetOutput(systemraw, ref output); }
public RESULT setOutput(OUTPUTTYPE output) { return(System.FMOD5_System_SetOutput(this.rawPtr, output)); }
private static extern RESULT FMOD_System_SetOutput(IntPtr system, OUTPUTTYPE output);
public RESULT setOutput(OUTPUTTYPE output) { return(FMOD5_System_SetOutput(handle, output)); }