private MusicPlayer() { result = FMOD.Factory.System_Create(out FMODSystem); if (result != FMOD.RESULT.OK) { throw new Exception("This crap didn't work!!"); } result = FMODSystem.setDSPBufferSize(1024, 10); result = FMODSystem.init(32, FMOD.INITFLAGS.NORMAL, (IntPtr)0); var info = new FMOD.CREATESOUNDEXINFO(); var song = new FMOD.Sound(); ChannelGroup = new FMOD.ChannelGroup(); ChannelGroup.clearHandle(); result = FMODSystem.createStream("rain.ogg", FMOD.MODE.DEFAULT, out song); result = FMODSystem.playSound(song, ChannelGroup, false, out Channel); bool isPlaying = false; Channel.isPlaying(out isPlaying); Channel.setVolume(1); Channel.setMode(FMOD.MODE.LOOP_NORMAL); Channel.setLoopCount(-1); int t = 1; }
public RESULT getChannelGroup(out FMOD.ChannelGroup group) { RESULT result = RESULT.OK; IntPtr groupraw = new IntPtr(); group = null; try { result = FMOD_Studio_EventInstance_GetChannelGroup(rawPtr, out groupraw); } catch { result = RESULT.ERR_INVALID_PARAM; } if (result != RESULT.OK) { return(result); } group = new FMOD.ChannelGroup(); group.setRaw(groupraw); return(result); }
public SoundController(Layer layer) : base(layer) { MusicGroup = AudioMgr.CreateChannelGroup("music"); SoundGroup = AudioMgr.CreateChannelGroup("sound"); MusicGroup.setVolume(MusicVolume); SoundGroup.setVolume(SoundVolume); }
public LayeredSound(FMOD.ChannelGroup group) { _layers = new Dictionary <string, Sound>(); _channels = new Dictionary <string, SoundChannel>(); _volumeTransitions = new Dictionary <string, Transition>(); ChannelGroup = group; }
public void Init(string _busPath, Bus _currentBus, FMOD.ChannelGroup _channelGroup, float _volume, bool _muted) { Debug.Log("Init"); m_busPath = _busPath; m_bus = _currentBus; m_channelGruop = _channelGroup; m_busVolume = _volume; m_isMuted = _muted; }
public void GetChannelGroup_SameGroupTest() { int test = 3; FMOD.ChannelGroup cg1 = s_system.GetChannelGroup(test); Assert.IsNotNull(cg1); FMOD.ChannelGroup cg2 = s_system.GetChannelGroup(test); Assert.IsNotNull(cg2); Assert.AreEqual(cg1, cg2); }
/// <summary> /// Play a loaded sound on a specified channel. /// </summary> /// <param name="p_sound">A loaded sound.</param> /// <param name="p_channelGroup">The channel group to play on.</param> /// <param name="o_channel">The channel created.</param> /// <returns></returns> public bool PlaySound(FMOD.Sound p_sound, FMOD.ChannelGroup p_channelGroup, out FMOD.Channel o_channel) { FMOD.RESULT r = m_fmodSystem.playSound( p_sound, p_channelGroup, false, out o_channel ); return(r == FMOD.RESULT.OK); }
public FMOD.Channel PlaySound(FMOD.Sound sound, FMOD.ChannelGroup group, bool paused = false) { FMOD.Channel channel; FMOD.RESULT res = soundSystem.playSound(sound, group, paused, out channel); if (res == FMOD.RESULT.OK) { return(channel); } else { throw new Exceptions.LoadFailException(FMOD.Error.String(res)); } }
internal FMODGrouping([NotNull] FMODAudioEngine engine, [NotNull] FMOD.ChannelGroup channelGroup) { if (engine == null) { throw new ArgumentNullException("engine"); } if (channelGroup == null) { throw new ArgumentNullException("channelGroup"); } _engine = engine; _channelGroup = channelGroup; _external = true; }
public void Initialize() { if (system == null) { result = FMOD.Factory.System_Create(out system); result = system.init(512, FMOD.INITFLAGS.NORMAL, IntPtr.Zero); } PlayList = new List <string>(); ChannelGroup = new FMOD.ChannelGroup(IntPtr.Zero); Channel = new FMOD.Channel(IntPtr.Zero); spectrum = new float[512]; previousSpectrum = spectrum; EnableFFT(); }
public void Dispose() { if (_external) { return; } lock (_engine.Lock) { if (_isDisposed) { return; } _isDisposed = true; _channelGroup.release(); _channelGroup = null; _engine.RemoveGrouping(this); } }
public static FMOD.Channel?PlaySound(int id, float vol, float pan, FMOD.ChannelGroup group) { if (SoundList.ContainsKey(id)) { var result = FMODUnity.RuntimeManager.CoreSystem.playSound(SoundList[id], group, true, out FMOD.Channel channel); if (result == FMOD.RESULT.OK) { channel.setVolume(vol); channel.setPan(pan); channel.setPaused(false); return(channel); } else { return(null); } } else { return(null); } }
public static void Init(ContentManager content) { _channelGroup = AudioMgr.CreateChannelGroup("group"); Title = AudioMgr.LoadStreamedSound(_musicDir + "Title"); Overworld = AudioMgr.LoadStreamedSound(_musicDir + "Overworld"); Battle = AudioMgr.LoadStreamedSound(_musicDir + "Battle"); FinalBattle = AudioMgr.LoadStreamedSound(_musicDir + "FinalBattle"); Blip = AudioMgr.LoadSound(_soundDir + "Blip"); Back = AudioMgr.LoadSound(_soundDir + "Back"); Hit = AudioMgr.LoadSound(_soundDir + "Hit"); Death = AudioMgr.LoadSound(_soundDir + "Death"); ArenaAppearEffect = AudioMgr.LoadSound(_soundDir + "ArenaAppearEffect"); Voice = AudioMgr.LoadSound(_soundDir + "Voice"); OpenGate = AudioMgr.LoadSound(_soundDir + "OpenGate"); OpenChest = AudioMgr.LoadSound(_soundDir + "OpenChest"); Heal = AudioMgr.LoadSound(_soundDir + "Heal"); NewGame = AudioMgr.LoadSound(_soundDir + "NewGame"); Win = AudioMgr.LoadSound(_soundDir + "Win"); Potion = AudioMgr.LoadSound(_soundDir + "Potion"); }
public void Play() { if (FModSounds.Instance == null || FMODSound == null || Configuration.sounds == false) { return; } FMOD.ChannelGroup channelGroup = new FMOD.ChannelGroup(); FModSounds.Instance.FMODSystem.getMasterChannelGroup(ref channelGroup); int numChannels = 0; channelGroup.getNumChannels(ref numChannels); FModSounds.Instance.FMODSystem.playSound( (FMOD.CHANNELINDEX)(index), FMODSound, false, ref FMODChannel ); index++; if (index > numChannels) { index = 0; } }
public RESULT getChannelGroup(out FMOD.ChannelGroup group) { group = null; IntPtr groupraw = new IntPtr(); RESULT result = FMOD_Studio_Bus_GetChannelGroup(rawPtr, out groupraw); if (result != RESULT.OK) { return result; } group = new FMOD.ChannelGroup(groupraw); return result; }
public RESULT getChannelGroup(out FMOD.ChannelGroup group) { RESULT result = RESULT.OK; IntPtr groupraw = new IntPtr(); group = null; try { result = FMOD_Studio_EventInstance_GetChannelGroup(rawPtr, out groupraw); } catch { result = RESULT.ERR_INVALID_PARAM; } if (result != RESULT.OK) { return result; } group = new FMOD.ChannelGroup(); group.setRaw(groupraw); return result; }