Updated PCI IDs to latest snapshot.
[tangerine.git] / workbench / libs / camd / nextmidilink.c
blobea633533bcd9e7927fdde8459261817811301b8c
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: English
7 */
9 #include "camd_intern.h"
12 /*****************************************************************************
14 NAME */
16 AROS_LH3(struct MidiLink *, NextMidiLink,
18 /* SYNOPSIS */
19 AROS_LHA(struct MidiNode *, midinode, A0),
20 AROS_LHA(struct MidiLink *, midilink, A1),
21 AROS_LHA(LONG, type, D0),
23 /* LOCATION */
24 struct CamdBase *, CamdBase, 19, Camd)
26 /* FUNCTION
27 Returns the next MidiLink of a specified type that belongs
28 to a midinode. Or NULL if midilink was the last. If midilink
29 is NULL, returns the first one.
31 INPUTS
32 type - MLTYPE_Sender or MLTYPE_Receiver.
34 RESULT
36 NOTES
37 CL_Linkages must be locked.
39 EXAMPLE
41 BUGS
43 SEE ALSO
45 INTERNALS
47 HISTORY
49 2001-01-12 ksvalast first created
50 2006-01-16 Lyle Hazelwood complete re-write.
52 *****************************************************************************/
54 AROS_LIBFUNC_INIT
56 struct MinNode *node;
58 if(type==MLTYPE_Receiver){
59 node=midinode->mi_InLinks.mlh_Head;
60 }else{
61 node=midinode->mi_OutLinks.mlh_Head;
64 if(midilink == NULL){
65 if(node->mln_Succ != NULL){
66 return(GetMidiLinkFromOwnerNode(node));
67 }else{
68 return(NULL);
70 }else{
71 node=&midilink->ml_OwnerNode;
72 node=node->mln_Succ;
73 if(node->mln_Succ != NULL){
74 return(GetMidiLinkFromOwnerNode(node));
75 }else{
76 return(NULL);
81 while(node->mln_Succ!=NULL){
82 if(midilink==NULL){
83 return (struct MidiLink *)node;
84 }else{
85 if(node==(struct MinNode *)midilink){
86 if(node->mln_Succ->mln_Succ!=NULL){
87 return GetMidiLinkFromOwnerNode(node->mln_Succ);
88 }else{
89 return NULL;
93 node=node->mln_Succ;
96 return NULL;
99 AROS_LIBFUNC_EXIT