//private int[] mSampleRates = new int[] { 8000, 11025, 22050, 44100 }; //private int[] audioFormats = new int[] { (int)Encoding.Pcm8bit, (int)Encoding.Pcm16bit }; //private int[] channelConfigs = new int[] { (int)ChannelIn.Mono, (int)ChannelIn.Stereo }; //private int rate = 44100; //private Encoding audioEncoding = Encoding.Pcm16bit; //private ChannelIn channelConfig = ChannelIn.Stereo; //public Action<bool> RecordingStateChanged; //public string[] PermissionsAudio { get; } = { // Manifest.Permission.RecordAudio // }; protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); _container = new TinyIoCContainer(); _container.Register <IAudioRecorder, AudioRecorder>().AsSingleton(); _container.Register <IAudioPlayback, AudioPlayback>().AsSingleton(); _container.Register <ITrackMixer, TrackMixer>().AsSingleton(); _audioPlayback = _container.Resolve <IAudioPlayback>(); _audioRecorder = _container.Resolve <IAudioRecorder>(); _trackMixer = _container.Resolve <ITrackMixer>(); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); audioTracks = new List <byte[]>(); //layout = FindViewById<LinearLayout>(Resource.Layout.Main); //mainTextView = FindViewById<TextView>(Resource.Id.textView1); Button startRecordingButton = FindViewById <Button>(Resource.Id.btnStartRecording); Button stopRecordingButton = FindViewById <Button>(Resource.Id.btnStopRecording); Button playbackButton = FindViewById <Button>(Resource.Id.btnPlayback); Button mixtrackButton = FindViewById <Button>(Resource.Id.btnMixTracks); startRecordingButton.Click += async(sender, e) => await StartRecordingButton_Click(); stopRecordingButton.Click += async(sender, e) => await StopRecordingButton_Click(); playbackButton.Click += async(sender, e) => await PlaybackButton_Click(); mixtrackButton.Click += async(sender, e) => await MixtrackButton_Click(); }
public static int PlaySound(IntPtr l) { int result; try { int num = LuaDLL.lua_gettop(l); if (LuaObject.matchType(l, num, 2, typeof(AudioClip), typeof(float))) { AudioManager4Unity audioManager4Unity = (AudioManager4Unity)LuaObject.checkSelf(l); AudioClip sound; LuaObject.checkType <AudioClip>(l, 2, out sound); float volume; LuaObject.checkType(l, 3, out volume); audioManager4Unity.PlaySound(sound, volume); LuaObject.pushValue(l, true); result = 1; } else if (LuaObject.matchType(l, num, 2, typeof(string), typeof(float))) { AudioManager4Unity audioManager4Unity2 = (AudioManager4Unity)LuaObject.checkSelf(l); string sound2; LuaObject.checkType(l, 2, out sound2); float volume2; LuaObject.checkType(l, 3, out volume2); IAudioPlayback o = audioManager4Unity2.PlaySound(sound2, volume2); LuaObject.pushValue(l, true); LuaObject.pushValue(l, o); result = 2; } else if (num == 5) { AudioManager4Unity audioManager4Unity3 = (AudioManager4Unity)LuaObject.checkSelf(l); string sound3; LuaObject.checkType(l, 2, out sound3); AudioClip audioClip; LuaObject.checkType <AudioClip>(l, 3, out audioClip); float volume3; LuaObject.checkType(l, 4, out volume3); bool allowRepeatedPlaying; LuaObject.checkType(l, 5, out allowRepeatedPlaying); audioManager4Unity3.PlaySound(sound3, audioClip, volume3, allowRepeatedPlaying); LuaObject.pushValue(l, true); result = 1; } else { LuaObject.pushValue(l, false); LuaDLL.lua_pushstring(l, "No matched override function PlaySound to call"); result = 2; } } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
// Token: 0x0600523A RID: 21050 RVA: 0x00186450 File Offset: 0x00184650 public void Execute(string strParams) { ArgumentsParser argumentsParser = new ArgumentsParser("s", strParams); IAudioPlayback audioPlayback = AudioUtility.PlaySound(argumentsParser.GetString(0)); if (audioPlayback != null) { Debug.Log(string.Format("sound length: {0} seconds.", audioPlayback.Seconds)); } }
// Token: 0x060001FD RID: 509 RVA: 0x0000A9CC File Offset: 0x00008BCC private void AddPlaybackToSheet(string sheetName, IAudioPlayback playback) { AudioManager4CRI.PlaybacksOfSheet playbacksOfSheet; if (!this.m_playbacksOfSheets.TryGetValue(sheetName, out playbacksOfSheet)) { playbacksOfSheet = new AudioManager4CRI.PlaybacksOfSheet(); this.m_playbacksOfSheets.Add(sheetName, playbacksOfSheet); } if (playback != null) { if (playbacksOfSheet.m_playbacks.Count == 0) { playbacksOfSheet.m_removeTime = float.MaxValue; } playbacksOfSheet.m_playbacks.Add(playback); } }
public static int PlaySound_s(IntPtr l) { int result; try { int total = LuaDLL.lua_gettop(l); if (LuaObject.matchType(l, total, 1, typeof(string))) { string name; LuaObject.checkType(l, 1, out name); IAudioPlayback o = AudioUtility.PlaySound(name); LuaObject.pushValue(l, true); LuaObject.pushValue(l, o); result = 2; } else if (LuaObject.matchType(l, total, 1, typeof(SoundTableId))) { SoundTableId id; LuaObject.checkEnum <SoundTableId>(l, 1, out id); AudioUtility.PlaySound(id); LuaObject.pushValue(l, true); result = 1; } else if (LuaObject.matchType(l, total, 1, typeof(AudioClip))) { AudioClip a; LuaObject.checkType <AudioClip>(l, 1, out a); AudioUtility.PlaySound(a); LuaObject.pushValue(l, true); result = 1; } else { LuaObject.pushValue(l, false); LuaDLL.lua_pushstring(l, "No matched override function PlaySound to call"); result = 2; } } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
// Token: 0x060001FB RID: 507 RVA: 0x0000A8A8 File Offset: 0x00008AA8 public IAudioPlayback PlaySound(string sound, float volume = 1f) { if (this.m_muteSound) { return(null); } sound = sound.Trim(); if (sound.ToLower().StartsWith("stop,")) { this.StopSound(sound.Substring(5)); return(null); } if (!this.AllocSheetByCueName(sound)) { return(null); } IAudioPlayback audioPlayback = this.m_CRIProvider.PlaySound(sound); this.AddPlaybackToSheet(this.GetSheetName(sound), audioPlayback); return(audioPlayback); }
public TrackMixer(IAudioPlayback audioPlayback) { _audioPlayback = audioPlayback; }