diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2020-12-06 21:23:48 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2020-12-06 21:24:20 +0900 |
commit | 4f99f868f09bbffa2e15733b8b7c78eba07a199e (patch) | |
tree | 3fb0957e93160f69f55942fff50a2ad496bf4f4c /libtdemid/notearray.cc | |
parent | 19f44e5ff3756172540e768fc0d08d761f0c374e (diff) | |
download | tdelibs-4f99f868f09bbffa2e15733b8b7c78eba07a199e.tar.gz tdelibs-4f99f868f09bbffa2e15733b8b7c78eba07a199e.zip |
Renaming of files in preparation for code style tools.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'libtdemid/notearray.cc')
-rw-r--r-- | libtdemid/notearray.cc | 122 |
1 files changed, 0 insertions, 122 deletions
diff --git a/libtdemid/notearray.cc b/libtdemid/notearray.cc deleted file mode 100644 index 9899fd837..000000000 --- a/libtdemid/notearray.cc +++ /dev/null @@ -1,122 +0,0 @@ -/************************************************************************** - - notearray.cc - NoteArray class, which holds an array of notes - This file is part of LibKMid 0.9.5 - Copyright (C) 1998,99,2000 Antonio Larrosa Jimenez - LibKMid's homepage : http://www.arrakis.es/~rlarrosa/libtdemid.html - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - Send comments and bug fixes to Antonio Larrosa <larrosa@kde.org> - -***************************************************************************/ - -#include "notearray.h" -#include <string.h> - -NoteArray::NoteArray(void) -{ - totalAllocated=50; - data=new noteCmd[totalAllocated]; - lastAdded=0L; -} - -NoteArray::~NoteArray() -{ - delete data; - totalAllocated=0; -} - -NoteArray::noteCmd *NoteArray::pointerTo(ulong pos) -{ - if (pos<totalAllocated) return &data[pos]; - while (pos>=totalAllocated) - { - noteCmd *tmp=new noteCmd[totalAllocated*2]; - memcpy(tmp,data,sizeof(noteCmd)*totalAllocated); - delete data; - data=tmp; - totalAllocated*=2; - } - return &data[pos]; -} - -void NoteArray::at(ulong pos, ulong ms,int chn,int cmd,int note) -{ - noteCmd *tmp=pointerTo(pos); - tmp->ms=ms; - tmp->chn=chn; - tmp->cmd=cmd; - tmp->note=note; -} - -void NoteArray::at(ulong pos, noteCmd s) -{ - noteCmd *tmp=pointerTo(pos); - tmp->ms=s.ms; - tmp->chn=s.chn; - tmp->cmd=s.cmd; - tmp->note=s.note; -} - -NoteArray::noteCmd NoteArray::at(int pos) -{ - return *pointerTo(pos); -} - -void NoteArray::add(ulong ms,int chn,int cmd,int note) -{ - if (lastAdded==NULL) - { - lastAdded=data; - last=0; - } - else - { - last++; - if (last==totalAllocated) lastAdded=pointerTo(totalAllocated); - else lastAdded++; - } - lastAdded->ms=ms; - lastAdded->chn=chn; - lastAdded->cmd=cmd; - lastAdded->note=note; -} - -void NoteArray::next(void) -{ - if (it==lastAdded) {it=NULL;return;}; - it++; -} - -void NoteArray::moveIteratorTo(ulong ms,int *pgm) -{ - noteCmd *ncmd; - iteratorBegin(); - ncmd=get(); - int pgm2[16]; - for (int j=0;j<16;j++) pgm2[j]=0; - while ((ncmd!=NULL)&&(ncmd->ms<ms)) - { - if (ncmd->cmd==2) pgm2[ncmd->chn]=ncmd->note; - next(); - ncmd=get(); - } - if (pgm!=NULL) - { - for (int i=0;i<16;i++) pgm[i]=pgm2[i]; - } -} |