![]() |
Mixxx
|
00001 /*************************************************************************** 00002 bpmscheme.cpp - Preset holding information for BPM detection 00003 ------------------- 00004 begin : Sat, Aug 25., 2007 00005 copyright : (C) 2007 by Micah Lee 00006 email : snipexv@gmail.com 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 #include "bpmscheme.h" 00019 #include "qstring.h" 00020 #include "xmlparse.h" 00021 #include <qdom.h> 00022 00023 BpmScheme::BpmScheme(const QString & name, int minBpm, int maxBpm, bool entire) 00024 :m_MinBpm(minBpm), m_MaxBpm(maxBpm), m_AnalyzeEntireSong(entire), m_Name(name) 00025 { 00026 } 00027 00028 BpmScheme::BpmScheme() 00029 { 00030 } 00031 00032 BpmScheme::~BpmScheme() 00033 { 00034 } 00035 00036 void BpmScheme::writeXML( QDomDocument & doc, QDomElement & header) 00037 { 00038 XmlParse::addElement(doc, header, "Name", m_Name); 00039 XmlParse::addElement(doc, header, "MinBpm", QString("%1").arg(m_MinBpm)); 00040 XmlParse::addElement(doc, header, "MaxBpm", QString("%1").arg(m_MaxBpm)); 00041 XmlParse::addElement(doc, header, "AnalyzeEntireSong", QString("%1").arg((int)m_AnalyzeEntireSong)); 00042 XmlParse::addElement(doc, header, "Comment", m_Comment); 00043 00044 } 00045 00046 int BpmScheme::getMinBpm() 00047 { 00048 m_qMutex.lock(); 00049 int min = m_MinBpm; 00050 m_qMutex.unlock(); 00051 return min; 00052 } 00053 00054 int BpmScheme::getMaxBpm() 00055 { 00056 m_qMutex.lock(); 00057 int max = m_MaxBpm; 00058 m_qMutex.unlock(); 00059 return max; 00060 } 00061 00062 QString BpmScheme::getName() 00063 { 00064 m_qMutex.lock(); 00065 QString name = m_Name; 00066 m_qMutex.unlock(); 00067 return name; 00068 } 00069 00070 QString BpmScheme::getComment() 00071 { 00072 m_qMutex.lock(); 00073 QString comment = m_Comment; 00074 m_qMutex.unlock(); 00075 return comment; 00076 } 00077 00078 bool BpmScheme::getAnalyzeEntireSong() 00079 { 00080 m_qMutex.lock(); 00081 bool entire = m_AnalyzeEntireSong; 00082 m_qMutex.unlock(); 00083 return entire; 00084 } 00085 00086 void BpmScheme::setMinBpm(const int minBpm) 00087 { 00088 m_qMutex.lock(); 00089 m_MinBpm = minBpm; 00090 m_qMutex.unlock(); 00091 } 00092 00093 void BpmScheme::setMaxBpm(const int maxBpm) 00094 { 00095 m_qMutex.lock(); 00096 m_MaxBpm = maxBpm; 00097 m_qMutex.unlock(); 00098 } 00099 00100 void BpmScheme::setName(const QString & name) 00101 { 00102 m_qMutex.lock(); 00103 m_Name = name; 00104 m_qMutex.unlock(); 00105 } 00106 00107 void BpmScheme::setComment(const QString & comment) 00108 { 00109 m_qMutex.lock(); 00110 m_Comment = comment; 00111 m_qMutex.unlock(); 00112 } 00113 00114 void BpmScheme::setAnalyzeEntireSong(const bool entire) 00115 { 00116 m_qMutex.lock(); 00117 m_AnalyzeEntireSong = entire; 00118 m_qMutex.unlock(); 00119 } 00120 00121