static void AddWriter ( struct AHIRequest *ioreq, struct AHIDevUnit *iounit, struct AHIBase *AHIBase ) { int channel; // Search for a free channel, and use if found for(channel = 0; channel < iounit->Channels; channel++) { if(iounit->Voices[channel].NextOffset == (ULONG) FREE) { Enqueue((struct List *) &iounit->PlayingList,(struct Node *) ioreq); PlayRequest(channel, ioreq, iounit, AHIBase); break; } } if(channel == iounit->Channels) { struct AHIRequest *ioreq2; // No free channel found. Check if we can kick the last one out... // There is at least on node in the list, and the last one has lowest priority. ioreq2 = (struct AHIRequest *) iounit->PlayingList.mlh_TailPred; if(ioreq->ahir_Std.io_Message.mn_Node.ln_Pri > ioreq2->ahir_Std.io_Message.mn_Node.ln_Pri) { // Let's steal his place! RemTail((struct List *) &iounit->PlayingList); channel = GetExtras(ioreq2)->Channel; GetExtras(ioreq2)->Channel = NOCHANNEL; Enqueue((struct List *) &iounit->SilentList,(struct Node *) ioreq2); Enqueue((struct List *) &iounit->PlayingList,(struct Node *) ioreq); PlayRequest(channel, ioreq, iounit, AHIBase); } else { // Let's be quiet for a while. GetExtras(ioreq)->Channel = NOCHANNEL; Enqueue((struct List *) &iounit->SilentList,(struct Node *) ioreq); } } }
void sdpPlayerExample::QSlotPlayClicked(void) { mtsDouble playTime = Time; //this should be read from the state table!!! playTime.Timestamp() = TimeServer.GetAbsoluteTimeInSeconds(); if (Sync) { PlayRequest(playTime); } else { //not quite thread safe, if there is mts play call this can be corrupt. State = PLAY; PlayUntilTime = PlayerDataInfo.DataEnd(); PlayStartTime = playTime; } }