1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2 /*
3 Rosegarden
4 A sequencer and musical notation editor.
5 Copyright 2000-2021 the Rosegarden development team.
6
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License as
9 published by the Free Software Foundation; either version 2 of the
10 License, or (at your option) any later version. See the file
11 COPYING included with this distribution for more information.
12 */
13
14
15 #include "AudioFile.h"
16 #include "QDateTime"
17
18 namespace Rosegarden
19
20 {
21
AudioFile(unsigned int id,const std::string & label,const QString & fileName)22 AudioFile::AudioFile(unsigned int id,
23 const std::string &label,
24 const QString &fileName):
25 SoundFile(fileName),
26 m_type(UNKNOWN),
27 m_id(id),
28 m_label(label),
29 m_bitsPerSample(0),
30 m_sampleRate(0),
31 m_channels(0),
32 m_dataChunkIndex( -1)
33 {
34 m_fileInfo = new QFileInfo(fileName);
35 }
36
AudioFile(const QString & fileName,unsigned int channels=1,unsigned int sampleRate=48000,unsigned int bitsPerSample=16)37 AudioFile::AudioFile(const QString &fileName,
38 unsigned int channels = 1,
39 unsigned int sampleRate = 48000,
40 unsigned int bitsPerSample = 16):
41 SoundFile(fileName),
42 m_type(UNKNOWN),
43 m_id(0),
44 m_label(""),
45 m_bitsPerSample(bitsPerSample),
46 m_sampleRate(sampleRate),
47 m_channels(channels),
48 m_dataChunkIndex( -1)
49 {
50 m_fileInfo = new QFileInfo(fileName);
51 }
52
~AudioFile()53 AudioFile::~AudioFile()
54 {
55 delete m_fileInfo;
56 }
57
58 QDateTime
getModificationDateTime()59 AudioFile::getModificationDateTime()
60 {
61 if (m_fileInfo)
62 return m_fileInfo->lastModified();
63 else
64 return QDateTime();
65 }
66
67
68 }
69
70