rem: KPrintF("New writer\n");
add: KPrintF("New writer (0x%08lx)\n", ioreq);
context: static void NewWriter(struct AHIRequest *ioreq, struct AHIDevUnit *iounit,    struct AHIBase *AHIBase){  int channel, sound;  BOOL delay = FALSE;  struct AHISampleInfo si;#ifdef DEBUG  KPrintF("New writer\n");#endif  si.ahisi_Type    = ioreq->ahir_Type;  si.ahisi_Address = ioreq->ahir_Std.io_Data;  si.ahisi_Length  = ioreq->ahir_Std.io_Length;  // Load the sound    Forbid();  for(sound = 0; sound < MAXSOUNDS; sound++)  {    if(iounit->Sounds[sound] == SOUND_FREE)    {      iounit->Sounds[sound] = SOUND_IN_USE;      break;    }  }  Permit();  if((sound < MAXSOUNDS) &&     (AHI_LoadSound(sound, AHIST_DYNAMICSAMPLE, &si, iounit->AudioCtrl)      == AHIE_OK)) {#ifdef DEBUG    KPrintF("Loaded new sound: %ld\n", sound);#endif    GetExtras(ioreq)->Sound = sound;    ObtainSemaphore(&iounit->ListLock);      if(ioreq->ahir_Link)    {  #ifdef DEBUG      KPrintF("Linked\n");#endif        // See if the linked request is playing, silent or waiting...        if(FindNode((struct List *) &iounit->PlayingList,          (struct Node *) ioreq->ahir_Link))      {        delay = TRUE;      }      else if(FindNode((struct List *) &iounit->SilentList,          (struct Node *) ioreq->ahir_Link))      {        delay = TRUE;      }      else if(FindNode((struct List *) &iounit->WaitingList,          (struct Node *) ioreq->ahir_Link))      {        delay = TRUE;      }    }    // NOTE: ahir_Link changes direction here. When the user set's it, she makes a new  // request point to an old. We let the old point to the next (that's more natural,  // anyway...) It the user tries to link more than one request to another, we fail.      if(delay)    {  #ifdef DEBUG      KPrintF("Delayed\n");#endif        if( ! ioreq->ahir_Link->ahir_Link)      {        Disable();        channel = GetExtras(ioreq->ahir_Link)->Channel;        GetExtras(ioreq)->Channel = NOCHANNEL;          ioreq->ahir_Link->ahir_Link = ioreq;        ioreq->ahir_Link = NULL;        Enqueue((struct List *) &iounit->WaitingList,(struct Node *) ioreq);          if(channel != NOCHANNEL)        {          // Attach the request to the currently playing one            iounit->Voices[channel].QueuedRequest = ioreq;          iounit->Voices[channel].NextOffset  = PLAY;          iounit->Voices[channel].NextRequest = NULL;          AHI_Play(iounit->AudioCtrl,              AHIP_BeginChannel,  channel,              AHIP_LoopFreq,      ioreq->ahir_Frequency,              AHIP_LoopVol,       ioreq->ahir_Volume,              AHIP_LoopPan,       ioreq->ahir_Position,              AHIP_LoopSound,     GetExtras(ioreq)->Sound,              AHIP_LoopOffset,    ioreq->ahir_Std.io_Actual,              AHIP_LoopLength,    ioreq->ahir_Std.io_Length - ioreq->ahir_Std.io_Actual,              AHIP_EndChannel,    NULL,              TAG_DONE);        }        Enable();      }      else // She tried to add more than one request to another one      {         ioreq->ahir_Std.io_Error = AHIE_UNKNOWN;        TermIO(ioreq, AHIBase);      }    }    else // Sound is not delayed    {      ioreq->ahir_Link=NULL;      AddWriter(ioreq, iounit, AHIBase);    }    ReleaseSemaphore(&iounit->ListLock);  }  else // No free sound found, or sound failed to load  {    ioreq->ahir_Std.io_Error = AHIE_UNKNOWN;    TermIO(ioreq, AHIBase);  }}