annotate data/fileio/AudioFileReaderFactory.h @ 971:9869ea3a93b7

Fix some (probably benign) uninitialised members (from coverity scan)
author Chris Cannam
date Wed, 03 Sep 2014 11:09:26 +0100
parents d03b3d956358
children a1cd5abcb38b
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@392 24 class ProgressReporter;
Chris@148 25
Chris@148 26 class AudioFileReaderFactory
Chris@148 27 {
Chris@148 28 public:
Chris@148 29 /**
Chris@148 30 * Return the file extensions that we have audio file readers for,
Chris@148 31 * in a format suitable for use with QFileDialog. For example,
Chris@148 32 * "*.wav *.aiff *.ogg".
Chris@148 33 */
Chris@290 34 static QString getKnownExtensions();
Chris@148 35
Chris@148 36 /**
Chris@148 37 * Return an audio file reader initialised to the file at the
Chris@148 38 * given path, or NULL if no suitable reader for this path is
Chris@148 39 * available or the file cannot be opened.
Chris@297 40 *
Chris@297 41 * If targetRate is non-zero, the file will be resampled to that
Chris@297 42 * rate (transparently). You can query reader->getNativeRate()
Chris@297 43 * if you want to find out whether the file is being resampled
Chris@297 44 * or not.
Chris@297 45 *
Chris@920 46 * If normalised is true, the file data will be normalised to
Chris@920 47 * abs(max) == 1.0. Otherwise the file will not be normalised.
Chris@920 48 *
Chris@392 49 * If a ProgressReporter is provided, it will be updated with
Chris@392 50 * progress status. Caller retains ownership of the reporter
Chris@392 51 * object.
Chris@392 52 *
Chris@148 53 * Caller owns the returned object and must delete it after use.
Chris@148 54 */
Chris@327 55 static AudioFileReader *createReader(FileSource source,
Chris@929 56 int targetRate = 0,
Chris@920 57 bool normalised = false,
Chris@392 58 ProgressReporter *reporter = 0);
Chris@327 59
Chris@327 60 /**
Chris@327 61 * Return an audio file reader initialised to the file at the
Chris@327 62 * given path, or NULL if no suitable reader for this path is
Chris@327 63 * available or the file cannot be opened. If the reader supports
Chris@327 64 * threaded decoding, it will be used and the file decoded in a
Chris@327 65 * background thread.
Chris@327 66 *
Chris@327 67 * If targetRate is non-zero, the file will be resampled to that
Chris@327 68 * rate (transparently). You can query reader->getNativeRate()
Chris@327 69 * if you want to find out whether the file is being resampled
Chris@327 70 * or not.
Chris@327 71 *
Chris@920 72 * If normalised is true, the file data will be normalised to
Chris@920 73 * abs(max) == 1.0. Otherwise the file will not be normalised.
Chris@920 74 *
Chris@392 75 * If a ProgressReporter is provided, it will be updated with
Chris@392 76 * progress status. This will only be meaningful if threading
Chris@392 77 * mode is not used because the file reader in use does not
Chris@392 78 * support it; otherwise progress as reported will jump straight
Chris@392 79 * to 100% before threading mode takes over. Caller retains
Chris@392 80 * ownership of the reporter object.
Chris@392 81 *
Chris@327 82 * Caller owns the returned object and must delete it after use.
Chris@327 83 */
Chris@327 84 static AudioFileReader *createThreadingReader(FileSource source,
Chris@929 85 int targetRate = 0,
Chris@920 86 bool normalised = false,
Chris@392 87 ProgressReporter *reporter = 0);
Chris@327 88
Chris@327 89 protected:
Chris@327 90 static AudioFileReader *create(FileSource source,
Chris@929 91 int targetRate,
Chris@920 92 bool normalised,
Chris@392 93 bool threading,
Chris@392 94 ProgressReporter *reporter);
Chris@148 95 };
Chris@148 96
Chris@148 97 #endif
Chris@148 98