•QTMusic Sample Sequencer/Event Priority Queue.h

/*
    File:       Event Priority Queue.h
 
    Contains:   xxx put contents here xxx
 
    Written by: xxx put writers here xxx
 
    Copyright:  © 1992 by Apple Computer, Inc., all rights reserved.
 
    Change History (most recent first):
 
        <3+>     5/19/93    dvb     New calls for sorting.
         <3>     9/17/92    dvb     Flush call
        <1+>     5/11/92    dvb     It's mine, and I'm going to work on it.
         <1>     5/10/92    dvb     first checked in
 
*/
 
/*
 * file: Event Priority Queue.h
 *
 *
 */
 
 
#ifndef _EventPriorityQueue_
#define _EventPriorityQueue_
 
 
 
/*--------------------------
    Inclusions
--------------------------*/
 
#include <types.h>
 
/*--------------------------
    Structures
--------------------------*/
typedef struct
    {
    long time;
    long data1;
    long data2;
    long data3;
    } EPQEvent;
 
typedef struct
    {
    long size;      /* number of Events in queue */
    long maxSize;   /* number of Events possible */
    EPQEvent e[1];
    } EPQ;
 
#define kEPQEmpty 0x7fffFFFF
 
/*--------------------------
    Prototypes
--------------------------*/
 
EPQ *NewEPQ(long maxSize);
short DisposeEPQ(EPQ *q);
 
short AddEventEPQ(EPQ *q, const EPQEvent *inEvent);
long PeekTopEPQ(EPQ *q);
EPQEvent *PeekIndexedEPQ(EPQ *q,long index);
long GetSizeEPQ(EPQ *q);
void ExtractEventEPQ(EPQ *q, EPQEvent *outEvent);
void FlushEPQ(EPQ *q);
void SortEPQ(EPQ *q);
 
 
 
#endif _EventPriorityQueue_