anchor.diff:  int pcmPos = 0;
   int bufferPos = 0;
   
  -void initData(WAVEFORMATEXTENSIBLE waveFormat, int totalFrames) {
  -  final sampleRate = waveFormat.Format.nSamplesPerSec.toDouble();
  +/// Initialize data values.
  +void initData(WAVEFORMATEX waveFormat, int totalFrames) {
  +  final sampleRate = waveFormat.nSamplesPerSec.toDouble();
     pcmAudio = Float32List(sampleCount);
     final radsPerSec = 2 * math.pi * frequency / sampleRate;
     for (var i = 0; i < sampleCount; i++) {
       final sampleValue = math.sin(radsPerSec * i);
       pcmAudio[i] = sampleValue;
     }
  -  bufferSize = totalFrames * waveFormat.Format.nChannels;
  +  bufferSize = totalFrames * waveFormat.nChannels;
     print("bufferSize = $bufferSize");
  -  print("sampsPerChan = ${totalFrames / waveFormat.Format.nChannels}");
  -}
  -
  -/// Coerce a returned wave format into a consistent format.
  -Pointer<WAVEFORMATEXTENSIBLE> convertFormat(Pointer<WAVEFORMATEX> waveFormat) {
  -  if (waveFormat.ref.wFormatTag == WAVE_FORMAT_EXTENSIBLE) {
  -    return waveFormat.cast();
  -  } else {
  -    final waveFormatEx = calloc<WAVEFORMATEXTENSIBLE>()
  -      ..ref.Format = waveFormat.ref
  -      ..ref.SubFormat = GUIDFromString(WMMEDIASUBTYPE_Base).ref
  -      ..ref.SubFormat.Data1 = waveFormat.ref.wFormatTag
  -      ..ref.Samples.wValidBitsPerSample = waveFormat.ref.wBitsPerSample
  -      ..ref.dwChannelMask = 0
  -      ..ref.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
  -    return waveFormatEx;
  -  }
  -}
  -
  -void printFormat(Pointer<WAVEFORMATEXTENSIBLE> waveFormat) {
  -  print("Channel Count = ${waveFormat.ref.Format.nChannels}");
  -  final formatTag = waveFormat.ref.SubFormat.Data1;
  -  switch (formatTag) {
  -    case WAVE_FORMAT_IEEE_FLOAT:
  -      print("Audio Format = WAVE_FORMAT_IEEE_FLOAT");
  -      break;
  -    case WAVE_FORMAT_PCM:
  -      print("Audio Format = WAVE_FORMAT_PCM");
  -      break;
  -    default:
  -      print("Audio Format = Unknown");
  -      break;
  -  }
  +  print("sampsPerChan = ${totalFrames / waveFormat.nChannels}");
   }
   
   /// Loads data into the memory buffer.
   ///
   /// Returns true if there is data, else returns false (indicating silence).
   bool fillMemoryBuffer(
  -    int totalFrames, Pointer<BYTE> dataOut, WAVEFORMATEXTENSIBLE waveFormat) {
  +    int totalFrames, Pointer<BYTE> dataOut, WAVEFORMATEX waveFormat) {
     final fData = dataOut.cast<FLOAT>();
  -  final totalSamples = totalFrames * waveFormat.Format.nChannels;
  +  final totalSamples = totalFrames * waveFormat.nChannels;
     print("Frames to Fill = $totalFrames");
     print("Samples to Fill = $totalSamples");
     print("bufferPos = $bufferPos");
   
     if (pcmPos < sampleCount) {
  -    for (var i = 0; i < totalSamples; i += waveFormat.Format.nChannels) {
  -      for (var chan = 0; chan < waveFormat.Format.nChannels; chan++) {
  +    for (var i = 0; i < totalSamples; i += waveFormat.nChannels) {
  +      for (var chan = 0; chan < waveFormat.nChannels; chan++) {
           fData[i + chan] = (pcmPos < sampleCount) ? pcmAudio[pcmPos] : 0.0;
         }
         pcmPos++;
  
positive.code: 
    // Retrieve the default audio output device.
    final pDeviceEnumerator = MMDeviceEnumerator.createInstance();
    final ppEndpoint = calloc<Pointer<COMObject>>();
    check(pDeviceEnumerator.GetDefaultAudioEndpoint(
        0, // dataflow: rendering device
        0, // role: system notification sound
        ppEndpoint));
    pDeviceEnumerator.Release();
    free(pDeviceEnumerator.ptr);
  
    // Activate an IAudioClient interface for the output device.
    final pDevice = IMMDevice(ppEndpoint.cast());
    final iidAudioClient = convertToIID(IID_IAudioClient);
    final ppAudioClient = calloc<Pointer<COMObject>>();
    check(pDevice.Activate(iidAudioClient, CLSCTX_ALL, nullptr, ppAudioClient));
  
negative.code:   return bufferFrameCount;
  }
  
  /// Fail COM calls that don't complete successfully.
  void check(int hr) {
    if (FAILED(hr)) throw WindowsException(hr);
  }
  