diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-03-01 18:37:05 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-03-01 18:37:05 +0000 |
commit | 145364a8af6a1fec06556221e66d4b724a62fc9a (patch) | |
tree | 53bd71a544008c518034f208d64c932dc2883f50 /src/sound/MP3AudioFile.h | |
download | rosegarden-145364a8af6a1fec06556221e66d4b724a62fc9a.tar.gz rosegarden-145364a8af6a1fec06556221e66d4b724a62fc9a.zip |
Added old abandoned KDE3 version of the RoseGarden MIDI tool
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/rosegarden@1097595 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/sound/MP3AudioFile.h')
-rw-r--r-- | src/sound/MP3AudioFile.h | 128 |
1 files changed, 128 insertions, 0 deletions
diff --git a/src/sound/MP3AudioFile.h b/src/sound/MP3AudioFile.h new file mode 100644 index 0000000..2423cd9 --- /dev/null +++ b/src/sound/MP3AudioFile.h @@ -0,0 +1,128 @@ +// -*- c-basic-offset: 4 -*- + +/* + Rosegarden + A sequencer and musical notation editor. + + This program is Copyright 2000-2008 + Guillaume Laurent <[email protected]>, + Chris Cannam <[email protected]>, + Richard Bown <[email protected]> + + The moral right of the authors to claim authorship of this work + has been asserted. + + This program 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. See the file + COPYING included with this distribution for more information. +*/ + +#ifndef _MP3AUDIOFILE_H_ +#define _MP3AUDIOFILE_H_ + +#ifdef HAVE_LIBMAD + +#include "AudioFile.h" + +namespace Rosegarden +{ + +class MP3AudioFile : public AudioFile +{ +public: + MP3AudioFile(const unsigned int &id, + const std::string &name, + const std::string &fileName); + + MP3AudioFile(const std::string &fileName, + unsigned int channels, + unsigned int sampleRate, + unsigned int bytesPerSecond, + unsigned int bytesPerSample, + unsigned int bitsPerSample); + + ~MP3AudioFile(); + + // Override these methods for the WAV + // + virtual bool open(); + virtual bool write(); + virtual void close(); + + // Show the information we have on this file + // + virtual void printStats(); + + // Get all header information + // + void parseHeader(); + + // Offset to start of sample data + // + virtual std::streampos getDataOffset(); + + // Peak file name + // + virtual std::string getPeakFilename() + { return (m_fileName + std::string(".pk")); } + + // scan time was valid and successful. + // + virtual bool scanTo(const RealTime &time); + virtual bool scanTo(std::ifstream *file, const RealTime &time); + + // Scan forward in a file by a certain amount of time + // + virtual bool scanForward(const RealTime &time); + virtual bool scanForward(std::ifstream *file, const RealTime &time); + + // Return a number of samples - caller will have to + // de-interleave n-channel samples themselves. + // + virtual std::string getSampleFrames(std::ifstream *file, + unsigned int frames); + virtual unsigned int getSampleFrames(std::ifstream *file, + char *buf, + unsigned int frames); + virtual std::string getSampleFrames(unsigned int frames); + + // Return a number of (possibly) interleaved samples + // over a time slice from current file pointer position. + // + virtual std::string getSampleFrameSlice(std::ifstream *file, + const RealTime &time); + virtual std::string getSampleFrameSlice(const RealTime &time); + + // Append a string of samples to an already open (for writing) + // audio file. + // + virtual bool appendSamples(const std::string &buffer); + virtual bool appendSamples(const char *buffer, unsigned int samples); + + // Get the length of the sample in Seconds/Microseconds + // + virtual RealTime getLength(); + + virtual unsigned int getBytesPerFrame() { return 0; } + + + //!!! NOT IMPLEMENTED YET + // + virtual bool decode(const unsigned char *sourceData, + size_t sourceBytes, + size_t targetSampleRate, + size_t targetChannels, + size_t targetFrames, + std::vector<float *> &targetData, + bool addToResultBuffers = false) { return false; } + +}; + +} + +#endif // HAVE_LIBMAD + +#endif // _MP3AUDIOFILE_H_ + |