private NextNotificationTask HandleNewBytesInControlThread(int nextPlaceForBytes, int byteWindowSize, BufferNotificationEventArgs ea) { LockFlag lockFlag = LockFlag.None; int bytesObtained = ea.NewSoundByte.Length; if (bytesObtained > byteWindowSize) { SB.Stop(); throw new ApplicationException("An event handler provided the streaming buffer with " + bytesObtained + " bytes of sound, but it only requested " + byteWindowSize + " bytes."); } else if (bytesObtained == byteWindowSize) { SB.Write(nextPlaceForBytes, ea.NewSoundByte, lockFlag); } else { // Fill the remainder of the segment with silence. if (ea.NewSoundByte.Length > 0) { SB.Write(nextPlaceForBytes, ea.NewSoundByte, lockFlag); } SB.Write(nextPlaceForBytes + ea.NewSoundByte.Length, new byte[byteWindowSize - ea.NewSoundByte.Length], lockFlag); if (ea.SoundFinished) { return(NextNotificationTask.FillSectionWithSilence); } } return(NextNotificationTask.FillSectionWithNewSound); }
public AutoLocker(LockHelper helper, LockFlag flag) { if (helper == null) { throw new ArgumentNullException("helper"); } Debug.Assert(!helper.IsLocked(flag)); _helper = helper; _flag = flag; // Lock the locker at the object's creation time. _helper.Lock(_flag); }
private void Unlock(LockFlag flag) { _backingStore &= (~flag); }
private void Lock(LockFlag flag) { _backingStore |= flag; }
public bool IsLocked(LockFlag flag) { return((_backingStore & flag) != 0); }
private void Unlock(LockFlag flag) { _backingStore &= ( ~flag ); }
public AutoLocker(LockHelper helper, LockFlag flag) { if(helper == null) { throw new ArgumentNullException("helper"); } Debug.Assert(!helper.IsLocked(flag)); _helper = helper; _flag = flag; // Lock the locker at the object's creation time. _helper.Lock(_flag); }
public bool IsLocked(LockFlag flag) { return ( _backingStore & flag ) != 0; }
public void Write(int bufferStartingLocation, Stream data, int numberBytesToWrite, LockFlag flag) { throw new NotImplementedException(); }
public void Write(int bufferStartingLocation, Array data, LockFlag flag) { throw new NotImplementedException(); }
public Array Read(int bufferStartingLocation, Type returnedDataType, LockFlag flag, params int[] ranks) { throw new NotImplementedException(); }