public WaveBank( AudioEngine audioEngine, string nonStreamingWaveBankFilename ) { if (audioEngine == null) { throw new ArgumentNullException("audioEngine"); } if (String.IsNullOrEmpty(nonStreamingWaveBankFilename)) { throw new ArgumentNullException("nonStreamingWaveBankFilename"); } buffer = TitleContainer.ReadAllBytes( nonStreamingWaveBankFilename ); pin = GCHandle.Alloc(buffer, GCHandleType.Pinned); FAudio.FACTAudioEngine_CreateInMemoryWaveBank( audioEngine.handle, pin.AddrOfPinnedObject(), (uint)buffer.Length, 0, 0, out handle ); engine = audioEngine; selfReference = new WeakReference(this, true); engine.RegisterWaveBank(handle, selfReference); IsDisposed = false; }
public WaveBank( AudioEngine audioEngine, string nonStreamingWaveBankFilename ) { if (audioEngine == null) { throw new ArgumentNullException("audioEngine"); } if (String.IsNullOrEmpty(nonStreamingWaveBankFilename)) { throw new ArgumentNullException("nonStreamingWaveBankFilename"); } bankData = TitleContainer.ReadToPointer( nonStreamingWaveBankFilename, out bankDataLen ); FAudio.FACTAudioEngine_CreateInMemoryWaveBank( audioEngine.handle, bankData, (uint)bankDataLen, 0, 0, out handle ); engine = audioEngine; selfReference = new WeakReference(this, true); engine.RegisterWaveBank(handle, selfReference); IsDisposed = false; }
public WaveBank( AudioEngine audioEngine, string streamingWaveBankFilename, int offset, short packetsize ) { if (audioEngine == null) { throw new ArgumentNullException("audioEngine"); } if (String.IsNullOrEmpty(streamingWaveBankFilename)) { throw new ArgumentNullException("streamingWaveBankFilename"); } string safeName = MonoGame.Utilities.FileHelpers.NormalizeFilePathSeparators( streamingWaveBankFilename ); if (!Path.IsPathRooted(safeName)) { safeName = Path.Combine( TitleLocation.Path, safeName ); } ioStream = FAudio.FAudio_fopen(safeName); FAudio.FACTStreamingParameters settings = new FAudio.FACTStreamingParameters(); settings.file = ioStream; FAudio.FACTAudioEngine_CreateStreamingWaveBank( audioEngine.handle, ref settings, out handle ); engine = audioEngine; selfReference = new WeakReference(this, true); engine.RegisterWaveBank(handle, selfReference); IsDisposed = false; }