[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Traverso-commit] traverso/src/audiofileio/decode PeakDataReader....
From: |
Remon Sijrier |
Subject: |
[Traverso-commit] traverso/src/audiofileio/decode PeakDataReader.... |
Date: |
Tue, 18 Sep 2007 15:20:48 +0000 |
CVSROOT: /sources/traverso
Module name: traverso
Changes by: Remon Sijrier <r_sijrier> 07/09/18 15:20:48
Removed files:
src/audiofileio/decode: PeakDataReader.cpp PeakDataReader.h
Log message:
Moved to Peak as a helper class, it's not really suited as a decoder
'plugin'
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/src/audiofileio/decode/PeakDataReader.cpp?cvsroot=traverso&r1=1.3&r2=0
http://cvs.savannah.gnu.org/viewcvs/traverso/src/audiofileio/decode/PeakDataReader.h?cvsroot=traverso&r1=1.1&r2=0
Patches:
Index: PeakDataReader.cpp
===================================================================
RCS file: PeakDataReader.cpp
diff -N PeakDataReader.cpp
--- PeakDataReader.cpp 10 Sep 2007 21:22:44 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,115 +0,0 @@
-/*
-Copyright (C) 2007 Ben Levitt
-
-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.
-
-*/
-
-#include "PeakDataReader.h"
-#include <QFile>
-#include <QString>
-
-// Always put me below _all_ includes, this is needed
-// in case we run with memory leak detection enabled!
-#include "Debugger.h"
-
-
-PeakDataReader::PeakDataReader(QString filename)
- : AbstractAudioReader(filename)
-{
-
- m_file = fopen(m_fileName.toUtf8().data(),"rb");
-
- if (! m_file) {
- PERROR("Couldn't open peak file for reading! (%s)",
m_fileName.toUtf8().data());
- m_length = m_channels = 0;
- return;
- }
-
- fseek (m_file, 0, SEEK_END);
- m_channels = 1;
- m_nframes = ftell (m_file);
- m_rate = 44100;
-}
-
-
-PeakDataReader::~PeakDataReader()
-{
- if (m_file) {
- fclose(m_file);
- }
-}
-
-
-bool PeakDataReader::can_decode(QString filename)
-{
- if (!filename.contains(".peak")) return false;
- return true;
-}
-
-
-bool PeakDataReader::seek_private(nframes_t start)
-{
- Q_ASSERT(m_file);
-
-
- if (start >= m_nframes) {
- return false;
- }
-
- if (fseek (m_file, start, SEEK_SET) < 0) {
- PERROR("PeakDataReader: could not seek to data point %d within
%s", start, m_fileName.toUtf8().data());
- return false;
- }
-
- return true;
-}
-
-
-nframes_t PeakDataReader::read_private(DecodeBuffer* buffer, nframes_t
frameCount)
-{
- Q_ASSERT(m_file);
-
- int framesRead = fread((void*)buffer->readBuffer, sizeof(peak_data_t),
frameCount, m_file);
-
- peak_data_t* readbuffer = (peak_data_t*)(buffer->readBuffer);
-
- // De-interlace
- switch (m_channels) {
- case 1:
- for (int f = 0; f < framesRead; f++) {
- buffer->destination[0][f] = readbuffer[f];
- }
- break;
- case 2:
- for (int f = 0; f < framesRead; f++) {
- int pos = f*2;
- buffer->destination[0][f] =
(float)readbuffer[pos];
- buffer->destination[1][f] =
(float)readbuffer[pos + 1];
- }
- break;
- default:
- for (int f = 0; f < framesRead; f++) {
- for (int c = 0; c < m_channels; c++) {
- buffer->destination[c][f] =
(float)readbuffer[f * m_channels + c];
- }
- }
- }
-
- return framesRead;
-}
-
Index: PeakDataReader.h
===================================================================
RCS file: PeakDataReader.h
diff -N PeakDataReader.h
--- PeakDataReader.h 28 Aug 2007 19:51:51 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,48 +0,0 @@
-/*
-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 PEAK_DATA_READER_H
-#define PEAK_DATA_READER_H
-
-#include <AbstractAudioReader.h>
-
-
-class PeakDataReader : public AbstractAudioReader
-{
- public:
- PeakDataReader(QString filename);
- ~PeakDataReader();
-
- QString decoder_type() const {return "sndfile";}
-
- static bool can_decode(QString filename);
-
- protected:
- bool seek_private(nframes_t start);
- nframes_t read_private(DecodeBuffer* buffer, nframes_t
frameCount);
-
-
- private:
- FILE* m_file;
-
-};
-
-#endif
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Traverso-commit] traverso/src/audiofileio/decode PeakDataReader....,
Remon Sijrier <=