public static void Create(FmodSystem system, string filename, out GraphicsPath maxPath, out GraphicsPath avgPath) { var sound = system.CreateStream(filename); Create(sound, out maxPath, out avgPath); sound.Dispose(); }
void Run() { var quit = new ManualResetEvent(false); Console.CancelKeyPress += (s, a) => { quit.Set(); a.Cancel = true; }; using (var fmod = new FmodSystem()) { fmod.Init(); using (oscillator = (Oscillator)fmod.CreateDsp(DspType.Oscillator)) { oscillator.Play(); while (!quit.WaitOne(0)) { ShowPrompt(); ProcessInput(quit); Thread.Sleep(1); } } fmod.CloseSystem(); } }
public virtual void Initialize() { ShouldEndExample = false; ConsoleUpdateStart = 0; System = Fmod.CreateSystem(); }
public void ReInit(FmodSystem system, Channel channel) { DeInit(); FSystem = system; FChannel = channel; Init(); }
public Sound Load2DSoundFromFile(string path, bool loops = false) { return(new() { FModSound = FmodSystem.CreateSound(path, Mode._2D | (loops? Mode.Loop_Normal : Mode.Loop_Off)) }); }
}/*mtd*/ /// <summary> /// KOnstruktor inicializuje základní třídu, z níž jsou odvozeny třídy pro DSP efekty. /// </summary> /// <param name="fmod">Instance FMODSystem</param> /// <param name="plugin">Instance DSP pluginu</param> /// <param name="channelGroup">Instance skupiny kanálů</param> protected DSPBase(FmodSystem fmod, Plugin plugin, ChannelGroup channelGroup) { _fmod = fmod ?? throw new ArgumentNullException(nameof(fmod)); _plugin = plugin; _dsp = _fmod.CreateDSPByPlugin(_plugin); _channelGroup = channelGroup ?? throw new InvalidOperationException(nameof(channelGroup)); _channelGroup.AddDSP(ChannelControlDSPIndex.DSPTail, _dsp); } /*mtd*/
protected static void TestVersion(FmodSystem system) { var version = system.Version; if (version < Fmod.BindingVersion) { throw new NotSupportedException($"FMOD Library version {version} is less than Binding version {Fmod.BindingVersion}"); } }
private void InitializeFmod() { _system = Factory.CreateSystem(); _system.Initialize(InitFlags); foreach (var channel in Channels) { channel.SetSystem(ref _system); } }
public void LoadSound(FmodSystem system, string filename) { SoundChanged?.Invoke(this, EventArgs.Empty); new Thread(() => { using (var sound = system.CreateSound(filename, Mode.Default)) WaveformPathFactory.Create(sound, out _maxPeakPath, out _avgPeakPath); Invoke(new Action(RefreshBrushes)); }).Start(); }
private void WaveFormWindow_Load(object sender, EventArgs e) { _system = Factory.CreateSystem(); _system.Initialize(InitFlags.Normal); _sound = _system.CreateStream(SNUFF, Mode.LoopNormal); waveForm1.LoadSound(_sound); _channel = _system.PlaySound(_sound); totalMs = _sound.GetLength(); }
public Sound Load3DSoundFromFile(string path, bool loops = false) { var sound = new Sound() { FModSound = FmodSystem.CreateSound(path, Mode._3D | (loops? Mode.Loop_Normal : Mode.Loop_Off)) }; sound.FModSound.Set3DMinMaxDistance(MinDistance, MaxDistance); return(sound); }
private void btnGetSystemObjectWhenNotInitialized_Click(object sender, EventArgs e) { var fmod = new FmodSystem(); fmod.Init(); var dsp = fmod.CreateDsp(DspType.Oscillator); var channel = fmod.PlayDsp(dsp); var fmod2 = channel.SystemInstance; fmod.CloseSystem(); }
public SoundController(string fmodPath, float dopplerScale, float distanceFactor, float rollerScale) { DopplerScale = dopplerScale; DistanceFactor = distanceFactor; MaxDistance = distanceFactor * 8192f; MinDistance = distanceFactor * 0.5f; RollerScale = rollerScale; Fmod.SetLibraryLocation(fmodPath); FmodSystem = Fmod.CreateSystem(); FmodSystem.Init(32); FmodSystem.Set3DSettings(dopplerScale, distanceFactor, rollerScale); }
public FmodEqualizer(FmodSystem system, Channel channel) { IsPreampAvailable = false; FSystem = system; FChannel = channel; Name = "DefaultEqualizer"; Bands = new ObservableCollection <IEqualizerBand>(); Presets = new ObservableCollection <EqualizerSettings>(new ConfigSaver().GetSettings()); EqualizerSettings = InitializeCore.EqualizerSettingsHelper.LoadEqualizerSettings(Name).settings; IsEnabled = EqualizerSettings == null || EqualizerSettings.IsEnabled; Init(); }
public frmMain() { InitializeComponent(); fmod = new FmodSystem(); fmod.Init(); var timer = new Timer(); timer.Interval = 33; // approx 30FPS timer.Tick += (sender, args) => Render(); timer.Start(); }
public frmMain() { InitializeComponent(); fmod = new FmodSystem(); fmod.Init(); numSpectrumDetail_ValueChanged(null,null); var timer = new Timer(); timer.Interval = 1000 / 60; // second number = desired FPS timer.Tick += (sender, args) => Render(); timer.Start(); }
public FmodEqualizer(FmodSystem system, Channel channel) { IsPreampAvailable = false; FSystem = system; FChannel = channel; Bands = new ThreadSafeObservableCollection <IEqualizerBand>(); Presets = new ThreadSafeObservableCollection <EqualizerSettings>((IEnumerable <EqualizerSettings>) new ConfigSaver().GetSettings()); EqualizerSettings = InitializeSwitch.EqualizerSettingsHelper.LoadEqualizerSettings("CustomEq").settings; Name = EqualizerSettings.Name; SelectedPreset = Presets.IndexOf(Presets.FirstOrDefault(t => t.Name == EqualizerSettings.Name)); IsEnabled = EqualizerSettings == null || EqualizerSettings.IsEnabled; Init(); this.PropertyChanged += OnPropertyChanged; }
/// <summary> /// Kind of like a DSP factory. But not. /// </summary> internal static Dsp GetInstance(FmodSystem system, DspType type) { IntPtr handle = IntPtr.Zero; Errors.ThrowIfError(CreateDspByType(system.DangerousGetHandle(), type, ref handle)); if (type == DspType.Oscillator) { return(new Oscillator(handle, system)); } ; // TODO: implement other types throw new NotSupportedException("DSP type " + type + " not currently supported by nFMOD"); }
/// <summary> /// Konstruktor inicializuje instanci třídy pro obsluhu DSP efektu Resonance Audio Source. /// </summary> /// <param name="fmod">Instance systému FMOD</param> /// <param name="channelGroup">Skupina kanálů</param> /// <param name="plugin">Instance DSP pluginu</param> public ResonanceAudioSourceDSP(FmodSystem fmod, ChannelGroup channelGroup, Plugin plugin) : base(fmod, plugin, channelGroup) { Gain = DefGain; Spread = DefSpread; MinDistance = DefMinDistance; MaxDistance = DefMaxDistance; Occlusion = DefOcclusion; Directivity = DefDirectivity; DirSharpness = DefDirSharpness; _spatialAttributes = DefAttributes3d(); ByPassRoom = DefBypassRoom; NearFieldGain = DefNearFieldGain; NearFieldFX = DefNearFieldFX; }/*mtd*/
public static void Init() { _fmodSystem = Fmod.CreateSystem(); _fmodSystem.Init(32); _basePlugin = _fmodSystem.LoadPlugin("resonanceaudio.dll"); _listenerPlugin = _fmodSystem.GetNestedPlugin(_basePlugin, 0); _listenerDSP = _fmodSystem.CreateDSPByPlugin(_listenerPlugin); _soundFieldPlugin = _fmodSystem.GetNestedPlugin(_basePlugin, 1); _sourcePlugin = _fmodSystem.GetNestedPlugin(_basePlugin, 2); _masterChannelGroup = _fmodSystem.MasterChannelGroup; _spatialChannelGroup = _fmodSystem.CreateChannelGroup("spatial"); _masterChannelGroup.AddGroup(_spatialChannelGroup, false); _masterChannelGroup.AddDSP(ChannelControlDSPIndex.DspHead, _listenerDSP); }
public frmMain() { InitializeComponent(); _fmod = new FmodSystem(); _fmod.Init(32, InitFlags.SoftwareHRTF); _fmod.SetDspBufferSize(256,2); _drums = new Dictionary<DrumType, Sound>(); const SoundMode flags = SoundMode.NonBlocking | SoundMode.SoftwareProcessing; _drums[DrumType.Snare] = _fmod.CreateSound("data/snare.wav", flags); _drums[DrumType.TomMid] = _fmod.CreateSound("data/tom_mid.wav", flags); _drums[DrumType.TomLow] = _fmod.CreateSound("data/tom_low.wav", flags); _drums[DrumType.TomFloor] = _fmod.CreateSound("data/tom_floor.wav", flags); _drums[DrumType.Kick] = _fmod.CreateSound("data/kick.wav", flags); _drums[DrumType.HihatOpen] = _fmod.CreateSound("data/cym_hatopen.wav", flags); _drums[DrumType.HihatMid] = _fmod.CreateSound("data/cym_hatmid.wav", flags); _drums[DrumType.HithatClosed] = _fmod.CreateSound("data/cym_hatclosed.wav", flags); _drums[DrumType.CymbalCrash] = _fmod.CreateSound("data/cym_crash.wav", flags); _drums[DrumType.CymbalRide] = _fmod.CreateSound("data/cym_ride.wav", flags); }
public frmMain() { InitializeComponent(); _fmod = new FmodSystem(); _fmod.Init(32, InitFlags.SoftwareHRTF); _fmod.SetDspBufferSize(256, 2); _drums = new Dictionary <DrumType, Sound>(); const SoundMode flags = SoundMode.NonBlocking | SoundMode.SoftwareProcessing; _drums[DrumType.Snare] = _fmod.CreateSound("data/snare.wav", flags); _drums[DrumType.TomMid] = _fmod.CreateSound("data/tom_mid.wav", flags); _drums[DrumType.TomLow] = _fmod.CreateSound("data/tom_low.wav", flags); _drums[DrumType.TomFloor] = _fmod.CreateSound("data/tom_floor.wav", flags); _drums[DrumType.Kick] = _fmod.CreateSound("data/kick.wav", flags); _drums[DrumType.HihatOpen] = _fmod.CreateSound("data/cym_hatopen.wav", flags); _drums[DrumType.HihatMid] = _fmod.CreateSound("data/cym_hatmid.wav", flags); _drums[DrumType.HithatClosed] = _fmod.CreateSound("data/cym_hatclosed.wav", flags); _drums[DrumType.CymbalCrash] = _fmod.CreateSound("data/cym_crash.wav", flags); _drums[DrumType.CymbalRide] = _fmod.CreateSound("data/cym_ride.wav", flags); }
public FMODCoreAudioEngine(int sr = 44100) : base(sr) { system = Fmod.CreateSystem(); }
internal Dsp(IntPtr hnd, FmodSystem parent) { Parent = parent; SetHandle(hnd); }
public Channel PlaySound(Sound sound) { return(FmodSystem.PlaySound(sound.FModSound)); }
static SoundEx() { _system = Factory.CreateSystem(); _system.Initialize(); }
public void SetSystem(ref FmodSystem system) { _system = system; }
internal Oscillator(IntPtr hnd, FmodSystem parent) : base(hnd, parent) { }
public static Dsp CreateDsp(FmodSystem system) { return(system.CreateDSP(in Description)); }