traverso-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Traverso-commit] traverso/src/common APILinkedList.h AudioProces...


From: Remon Sijrier
Subject: [Traverso-commit] traverso/src/common APILinkedList.h AudioProces...
Date: Mon, 12 Nov 2007 18:50:48 +0000

CVSROOT:        /sources/traverso
Module name:    traverso
Changes by:     Remon Sijrier <r_sijrier>       07/11/12 18:50:48

Added files:
        src/common     : APILinkedList.h AudioProcessingItem.h 

Log message:
        * Added class AudioProcessingItem, which will be inherited from classes 
that have anything to do with audio processing.
        * Added AudioProcessingItemLinkedList class, which is an extremely 
lightweight linked list, who adds/removes items without calling new()/delete() 
which is good for Real Time use

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/src/common/APILinkedList.h?cvsroot=traverso&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/traverso/src/common/AudioProcessingItem.h?cvsroot=traverso&rev=1.1

Patches:
Index: APILinkedList.h
===================================================================
RCS file: APILinkedList.h
diff -N APILinkedList.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ APILinkedList.h     12 Nov 2007 18:50:48 -0000      1.1
@@ -0,0 +1,115 @@
+/*
+Copyright (C) 2007 Remon Sijrier
+
+This file is part of Traverso
+
+Traverso is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.
+
+*/
+
+#ifndef API_LINKED_LIST_H
+#define API_LINKED_LIST_H
+
+#include <QDebug>
+
+#include "AudioProcessingItem.h"
+
+class APILinkedList
+{
+public:
+       APILinkedList() : m_size(0), m_head(0) {}
+       ~APILinkedList() {}
+       
+       void append(AudioProcessingItem* item);
+       void prepend(AudioProcessingItem * item);
+       void add_after(AudioProcessingItem* after, AudioProcessingItem* item);
+       int remove(AudioProcessingItem* item);
+       
+       AudioProcessingItem* begin() {return m_head;}
+       AudioProcessingItem* get_next(AudioProcessingItem* item) {return 
item->next;}
+       int size() const {return m_size;}
+
+                       
+private:
+       int m_size;
+       AudioProcessingItem* m_head;
+};
+
+inline void APILinkedList::prepend(AudioProcessingItem * item)
+{
+       item->next = m_head;
+       m_head = item;
+}
+
+inline void APILinkedList::append(AudioProcessingItem * item)
+{
+       if(m_head) {
+               AudioProcessingItem *q,*temp;
+               q = m_head;
+               while( q->next != 0 ) {
+                       q = q->next;
+               }
+
+               temp = item;
+               temp->next = 0;
+               q->next = temp;
+       } else {
+               m_head = item;
+               m_head->next = 0;
+       }
+       m_size++;
+}
+
+inline int APILinkedList::remove(AudioProcessingItem * item)
+{
+       AudioProcessingItem *q,*r;
+       q = m_head;
+       if(q == item)
+       {
+               m_head = q->next;
+               m_size--;
+               return 1;
+       }
+
+       r = q;
+       while( q!=0 )
+       {
+               if( q == item )
+               {
+                       r->next = q->next;
+                       m_size--;
+                       return 1;
+               }
+
+               r = q;
+               q = q->next;
+       }
+               
+       return 0;
+}
+
+inline void APILinkedList::add_after(AudioProcessingItem* after, 
AudioProcessingItem* item)
+{
+       Q_ASSERT(after);
+       Q_ASSERT(item);
+       
+       AudioProcessingItem* temp;
+
+       temp = item;
+       temp->next = after->next;
+       after->next = temp;
+}
+
+#endif

Index: AudioProcessingItem.h
===================================================================
RCS file: AudioProcessingItem.h
diff -N AudioProcessingItem.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ AudioProcessingItem.h       12 Nov 2007 18:50:48 -0000      1.1
@@ -0,0 +1,45 @@
+/*
+Copyright (C) 2007 Remon Sijrier
+
+This file is part of Traverso
+
+Traverso is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.
+
+*/
+
+#ifndef AUDIO_PROCESSING_ITEM_H
+#define AUDIO_PROCESSING_ITEM_H
+
+class GainEnvelope;
+class PluginChain;
+
+class AudioProcessingItem 
+{
+public:
+       AudioProcessingItem () {}
+       ~AudioProcessingItem () {}
+       
+       bool is_muted() const {return m_isMuted;}
+
+       
+       AudioProcessingItem *next;
+       
+protected:
+       GainEnvelope* m_fader;
+       PluginChain* m_pluginChain;
+       bool m_isMuted;
+};
+
+#endif




reply via email to

[Prev in Thread] Current Thread [Next in Thread]