public Audio( IAudioDevice audioDevice, AudioInfo audioInfo ) { this.audioDevice = new WeakReference ( audioDevice ); this.audioInfo = audioInfo; bufferIds = new List<int> (); sourceId = AL.GenSource (); alFormat = ( ( audioInfo.AudioChannel == AudioChannel.Stereo ) ? ( ( audioInfo.BitPerSample == 2 ) ? ALFormat.Stereo16 : ALFormat.Stereo8 ) : ( ( audioInfo.BitPerSample == 2 ) ? ALFormat.Mono16 : ALFormat.Mono8 ) ); ( audioDevice as AudioDevice ).audioList.Add ( this ); }
public Audio( IAudioDevice audioDevice, AudioInfo audioInfo ) { this.audioDevice = new WeakReference ( audioDevice ); this.audioInfo = audioInfo; SharpDX.DirectSound.SoundBufferDescription bufferDesc = new SharpDX.DirectSound.SoundBufferDescription () { Flags = SharpDX.DirectSound.BufferFlags.ControlVolume | SharpDX.DirectSound.BufferFlags.ControlPan | SharpDX.DirectSound.BufferFlags.ControlPositionNotify | SharpDX.DirectSound.BufferFlags.StickyFocus | SharpDX.DirectSound.BufferFlags.Software | SharpDX.DirectSound.BufferFlags.GetCurrentPosition2 | SharpDX.DirectSound.BufferFlags.ControlFrequency, Format = new SharpDX.Multimedia.WaveFormat ( audioInfo.SampleRate, audioInfo.BitPerSample * 8, ( int ) audioInfo.AudioChannel ), BufferBytes = totalLength = ( int ) ( audioInfo.Duration.TotalSeconds * ( ( int ) audioInfo.AudioChannel * audioInfo.BitPerSample * audioInfo.SampleRate ) ), }; soundBuffer = new SharpDX.DirectSound.SecondarySoundBuffer ( audioDevice.Handle as SharpDX.DirectSound.DirectSound, bufferDesc ); ( audioDevice as AudioDevice ).audioList.Add ( this ); offset = 0; }
public IAudio CreateAudio( AudioInfo audioInfo ) { return new Audio ( this, audioInfo ); }
public Note( TimeSpan noteTime, int noteType = 0, object extendData = null, AudioInfo? noteSound = null ) { Position = noteTime; NoteType = noteType; if ( noteSound != null ) NoteSound = LiqueurSystem.AudioDevice.CreateAudio ( noteSound.Value ); ExtendData = extendData; }