Mixxx

/home/maxime/Projets/Mixxx/1.10/mixxx/src/soundsource.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           soundsource.h  -  description
00003                              -------------------
00004     begin                : Wed Feb 20 2002
00005     copyright            : (C) 2002 by Tue and Ken Haste Andersen
00006     email                :
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef SOUNDSOURCE_H
00019 #define SOUNDSOURCE_H
00020 
00021 #include <taglib/tfile.h>
00022 #include <taglib/apetag.h>
00023 #include <taglib/id3v2tag.h>
00024 #include <taglib/xiphcomment.h>
00025 #include <taglib/mp4tag.h>
00026 
00027 #include "defs.h"
00028 #include <QString>
00029 
00030 #define MIXXX_SOUNDSOURCE_API_VERSION 3
00031 
00038 namespace Mixxx {
00039     class SoundSource;
00040 }
00041 typedef Mixxx::SoundSource* (*getSoundSourceFunc)(QString filename);
00042 typedef char** (*getSupportedFileExtensionsFunc)();
00043 typedef int (*getSoundSourceAPIVersionFunc)();
00044 /* New in version 3 */
00045 typedef void (*freeFileExtensionsFunc)(char** exts);
00046 
00047 
00048 /*
00049   Base class for sound sources.
00050 */
00051 namespace Mixxx
00052 {
00053 class SoundSource
00054 {
00055 public:
00056     SoundSource(QString qFilename);
00057     virtual ~SoundSource();
00058     virtual int open() = 0;
00059     virtual long seek(long) = 0;
00060     virtual unsigned read(unsigned long size, const SAMPLE*) = 0;
00061     virtual long unsigned length() = 0;
00062     static float str2bpm( QString sBpm );
00063     virtual int parseHeader() = 0;
00064     //static QList<QString> supportedFileExtensions(); //CRAP can't do this!
00066     virtual QList<long> *getCuePoints();
00068     virtual QString getFilename();
00070     virtual QString getArtist();
00072     virtual QString getTitle();
00073     virtual QString getAlbum();
00074     virtual QString getType();
00075     virtual QString getComment();
00076     virtual QString getYear();
00077     virtual QString getGenre();
00078     virtual QString getTrackNumber();
00079     virtual float getReplayGain();
00080     virtual QString getKey();
00081     virtual float getBPM();
00082     virtual int getDuration();
00083     virtual int getBitrate();
00084     virtual unsigned int getSampleRate();
00085     virtual int getChannels();
00086 
00087     virtual void setArtist(QString);
00088     virtual void setTitle(QString);
00089     virtual void setAlbum(QString);
00090     virtual void setType(QString);
00091     virtual void setComment(QString);
00092     virtual void setYear(QString);
00093     virtual void setGenre(QString);
00094     virtual void setTrackNumber(QString);
00095     virtual void setReplayGain(float);
00096     virtual void setKey(QString);
00097     virtual void setBPM(float);
00098     virtual void setDuration(int);
00099     virtual void setBitrate(int);
00100     virtual void setSampleRate(unsigned int);
00101     virtual void setChannels(int);
00102 protected:
00103 
00104     // Automatically collects generic data from a TagLib File: title, artist,
00105     // album, comment, genre, year, tracknumber, duration, bitrate, samplerate,
00106     // and channels.
00107     bool processTaglibFile(TagLib::File& f);
00108     bool processID3v2Tag(TagLib::ID3v2::Tag* id3v2);
00109     bool processAPETag(TagLib::APE::Tag* ape);
00110     bool processXiphComment(TagLib::Ogg::XiphComment* xiph);
00111     bool processMP4Tag(TagLib::MP4::Tag* mp4);
00112     void processBpmString(QString tagName, QString sBpm);
00113     void parseReplayGainString(QString sReplayGain);
00114 
00116     QString m_qFilename;
00117 
00118     QString m_sArtist;
00119     QString m_sTitle;
00120     QString m_sAlbum;
00121     QString m_sType;
00122     QString m_sComment;
00123     QString m_sYear;
00124     QString m_sGenre;
00125     QString m_sTrackNumber;
00126     float m_fReplayGain;
00127     QString m_sKey;
00128     float m_fBPM;
00129     int m_iDuration;
00130     int m_iBitrate;
00132     unsigned int m_iSampleRate;
00133     int m_iChannels;
00134     //Dontcha be forgettin' to initialize these variables.... arr
00135 
00136     static const bool s_bDebugMetadata;
00137 };
00138 } //namespace Mixxx
00139 
00140 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines