annotate data/fileio/AudioFileReaderFactory.h @ 342:4175a4930186

* Fixes for handling of DOS paths (C:\blah) -- not an unknown URL scheme!
author Chris Cannam
date Mon, 26 Nov 2007 15:05:51 +0000
parents 1d656dcda8ef
children 183ee2a55fc7
rev   line source
Chris@148 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@148 2
Chris@148 3 /*
Chris@148 4 Sonic Visualiser
Chris@148 5 An audio file viewer and annotation editor.
Chris@148 6 Centre for Digital Music, Queen Mary, University of London.
Chris@148 7 This file copyright 2006 Chris Cannam.
Chris@148 8
Chris@148 9 This program is free software; you can redistribute it and/or
Chris@148 10 modify it under the terms of the GNU General Public License as
Chris@148 11 published by the Free Software Foundation; either version 2 of the
Chris@148 12 License, or (at your option) any later version. See the file
Chris@148 13 COPYING included with this distribution for more information.
Chris@148 14 */
Chris@148 15
Chris@148 16 #ifndef _AUDIO_FILE_READER_FACTORY_H_
Chris@148 17 #define _AUDIO_FILE_READER_FACTORY_H_
Chris@148 18
Chris@290 19 #include <QString>
Chris@148 20
Chris@317 21 #include "FileSource.h"
Chris@316 22
Chris@148 23 class AudioFileReader;
Chris@148 24
Chris@148 25 class AudioFileReaderFactory
Chris@148 26 {
Chris@148 27 public:
Chris@148 28 /**
Chris@148 29 * Return the file extensions that we have audio file readers for,
Chris@148 30 * in a format suitable for use with QFileDialog. For example,
Chris@148 31 * "*.wav *.aiff *.ogg".
Chris@148 32 */
Chris@290 33 static QString getKnownExtensions();
Chris@148 34
Chris@148 35 /**
Chris@148 36 * Return an audio file reader initialised to the file at the
Chris@148 37 * given path, or NULL if no suitable reader for this path is
Chris@148 38 * available or the file cannot be opened.
Chris@297 39 *
Chris@297 40 * If targetRate is non-zero, the file will be resampled to that
Chris@297 41 * rate (transparently). You can query reader->getNativeRate()
Chris@297 42 * if you want to find out whether the file is being resampled
Chris@297 43 * or not.
Chris@297 44 *
Chris@148 45 * Caller owns the returned object and must delete it after use.
Chris@148 46 */
Chris@327 47 static AudioFileReader *createReader(FileSource source,
Chris@327 48 size_t targetRate = 0);
Chris@327 49
Chris@327 50 /**
Chris@327 51 * Return an audio file reader initialised to the file at the
Chris@327 52 * given path, or NULL if no suitable reader for this path is
Chris@327 53 * available or the file cannot be opened. If the reader supports
Chris@327 54 * threaded decoding, it will be used and the file decoded in a
Chris@327 55 * background thread.
Chris@327 56 *
Chris@327 57 * If targetRate is non-zero, the file will be resampled to that
Chris@327 58 * rate (transparently). You can query reader->getNativeRate()
Chris@327 59 * if you want to find out whether the file is being resampled
Chris@327 60 * or not.
Chris@327 61 *
Chris@327 62 * Caller owns the returned object and must delete it after use.
Chris@327 63 */
Chris@327 64 static AudioFileReader *createThreadingReader(FileSource source,
Chris@327 65 size_t targetRate = 0);
Chris@327 66
Chris@327 67 protected:
Chris@327 68 static AudioFileReader *create(FileSource source,
Chris@327 69 size_t targetRate,
Chris@327 70 bool threading);
Chris@148 71 };
Chris@148 72
Chris@148 73 #endif
Chris@148 74