public void SetAudioSourceToSFXChannel(AudioSource newSource, AudioTrack track) { if (newSource != null) { newSource.outputAudioMixerGroup = GetAudioGroupRef(track.ToString()); } }
public AudioPlugin(IServiceProvider serviceProvider) : base(Strings.Audio_Plugin_Title, new Guid(0xf0fc9a84, 0x5be9, 0x4598, 0x8c, 0xd8, 0xbb, 0xdd, 0x47, 0x2d, 0x5f, 0xbd)) { if (serviceProvider != null) { this.loggingService = serviceProvider.GetService(typeof(ILoggingService)) as ILoggingService; } this.outString = Strings.Audio_Output; this.micStrings = new string[nui.Constants.AUDIO_NUM_MIC]; for (int i = 0; i < this.micStrings.Length; ++i) { AudioTrack track = (AudioTrack)(AudioTrack.Mic0 + i); this.micStrings[i] = Strings.ResourceManager.GetString("Audio_" + track.ToString()); Debug.Assert(this.micStrings[i] != null); } this.speakerStrings = new string[nui.Constants.AUDIO_NUM_SPK]; for (int i = 0; i < this.speakerStrings.Length; ++i) { AudioTrack track = (AudioTrack)(AudioTrack.SpeakerL + i); this.speakerStrings[i] = Strings.ResourceManager.GetString("Audio_" + track.ToString()); Debug.Assert(this.speakerStrings[i] != null); } }
private int GetNumberOfVoicesAssignedToChannel(AudioTrack track) { foreach (GameAudioChannel channel in channels) { if (channel.mixerGroupName == track.ToString()) { return(channel.numVoicesAssigned); } } return(0); }
public async Task QueueAsync([Remainder] string query) { int playlistInUrlIndex = query.IndexOf("&list="); if (playlistInUrlIndex >= 0) { query = query.Substring(0, playlistInUrlIndex); } var search = await _lavaRestClient.SearchYouTubeAsync(query); if (search.LoadType == LoadType.LoadFailed) { await ReplyAsync("Load failed. The url could be wrong or maybe LavaLink needs an update."); return; } if (search.LoadType == LoadType.NoMatches) { await ReplyAsync("Nothing found"); return; } var audio = search.Tracks.First(); var track = new AudioTrack { Audio = audio, Player = player, TimeAdded = DateTime.Now, User = Context.User }; if (player.Queue.Count > 0 || player.CurrentTrack != null) { player.Queue.Enqueue(track); } else { await player.PlayAsync(track); } await ReplyAsync($"{track.ToString()} has been queued."); }
public async Task <RuntimeResult> ReplayPreviousAsync() { AudioTrack trackToReplay = null; if (player.PreviousTrack == null && player.CurrentTrack != null) { trackToReplay = player.CurrentTrack; } else if (player.PreviousTrack != null) { trackToReplay = player.PreviousTrack; } if (trackToReplay == null) { return(Reply("There is no track to replay.")); } await player.PlayAsync(trackToReplay); return(Reply($"Replaying song: {trackToReplay.ToString()}")); }