Removed UTF8 macro -- no longer used.

This commit is contained in:
casey 2016-05-01 21:55:05 -07:00
parent 410e9b9536
commit 5207bb36de
24 changed files with 101 additions and 108 deletions

View File

@ -103,11 +103,11 @@ bool TagReaderTaglib::CanReadTag(const char *extension){
boost::algorithm::to_lower(ext); // Convert to lower case boost::algorithm::to_lower(ext); // Convert to lower case
if( ext.compare(UTF("mp3")) == 0 || if( ext.compare("mp3") == 0 ||
ext.compare(UTF("ogg")) == 0 || ext.compare("ogg") == 0 ||
ext.compare(UTF("flac")) == 0 || ext.compare("flac") == 0 ||
ext.compare(UTF("ape")) == 0 || ext.compare("ape") == 0 ||
ext.compare(UTF("mpc")) == 0 ext.compare("mpc") == 0
) { ) {
return true; return true;
} }
@ -125,14 +125,14 @@ bool TagReaderTaglib::ReadTag(musik::core::ITrack *track){
string ext(extension); string ext(extension);
boost::algorithm::to_lower(ext); // Convert to lower case boost::algorithm::to_lower(ext); // Convert to lower case
if(ext==UTF("mp3")) if(ext=="mp3")
if(this->GetID3v2Tag(track)){ if(this->GetID3v2Tag(track)){
// Get the generic tag as well, just in case there is only a id3v1 tag. // Get the generic tag as well, just in case there is only a id3v1 tag.
this->GetGenericTag(track); this->GetGenericTag(track);
return true; return true;
} }
if(ext==UTF("ogg")) if(ext=="ogg")
if(this->GetOGGTag(track)) if(this->GetOGGTag(track))
return true; return true;
@ -228,7 +228,7 @@ bool TagReaderTaglib::GetID3v2Tag(musik::core::ITrack *track){
std::vector<string> splitTrack; std::vector<string> splitTrack;
if(!aAllTags["TRCK"].isEmpty()){ if(!aAllTags["TRCK"].isEmpty()){
TagLib::wstring tempTrack = aAllTags["TRCK"].front()->toString().toWString(); TagLib::wstring tempTrack = aAllTags["TRCK"].front()->toString().toWString();
boost::algorithm::split(splitTrack,tempTrack,boost::algorithm::is_any_of(UTF("/"))); boost::algorithm::split(splitTrack,tempTrack,boost::algorithm::is_any_of("/"));
this->SetTagValue("track",splitTrack[0].c_str(),track); this->SetTagValue("track",splitTrack[0].c_str(),track);
if(splitTrack.size()>1){ if(splitTrack.size()>1){
this->SetTagValue("totaltracks",splitTrack[1].c_str(),track); this->SetTagValue("totaltracks",splitTrack[1].c_str(),track);
@ -316,9 +316,9 @@ bool TagReaderTaglib::GetID3v2Tag(musik::core::ITrack *track){
if(description.empty()){ if(description.empty()){
this->SetTagValue("comment",comment->toString(),track); this->SetTagValue("comment",comment->toString(),track);
}else if(description.compare(UTF("MusicMatch_Mood")) == 0){ }else if(description.compare("MusicMatch_Mood") == 0){
this->SetTagValue("mood",comment->toString(),track); this->SetTagValue("mood",comment->toString(),track);
}else if(description.compare(UTF("MusicMatch_Preference")) == 0){ }else if(description.compare("MusicMatch_Preference") == 0){
this->SetTagValue("textrating",comment->toString(),track); this->SetTagValue("textrating",comment->toString(),track);
} }
} }
@ -372,7 +372,7 @@ void TagReaderTaglib::SetTagValue(const char* key,const char* string,musik::core
} }
void TagReaderTaglib::SetTagValue(const char* key,const int tagInt,musik::core::ITrack *track){ void TagReaderTaglib::SetTagValue(const char* key,const int tagInt,musik::core::ITrack *track){
string temp = boost::str(boost::format(UTF("%1%"))%tagInt); string temp = boost::str(boost::format("%1%")%tagInt);
track->SetValue(key,temp.c_str()); track->SetValue(key,temp.c_str());
} }
@ -411,7 +411,7 @@ void TagReaderTaglib::SetSlashSeparatedValues(const char* key,TagLib::String tag
string value(tagString.begin(),tagString.end()); string value(tagString.begin(),tagString.end());
std::vector<string> splitValues; std::vector<string> splitValues;
boost::algorithm::split(splitValues,value,boost::algorithm::is_any_of(UTF("/"))); boost::algorithm::split(splitValues,value,boost::algorithm::is_any_of("/"));
for(std::vector<string>::iterator theValue=splitValues.begin();theValue!=splitValues.end();++theValue){ for(std::vector<string>::iterator theValue=splitValues.begin();theValue!=splitValues.end();++theValue){
track->SetValue(key,theValue->c_str()); track->SetValue(key,theValue->c_str());
@ -441,19 +441,19 @@ void TagReaderTaglib::SetSlashSeparatedValues(const char* key,const TagLib::ID3v
void TagReaderTaglib::SetAudioProperties(TagLib::AudioProperties *audioProperties,musik::core::ITrack *track){ void TagReaderTaglib::SetAudioProperties(TagLib::AudioProperties *audioProperties,musik::core::ITrack *track){
if(audioProperties){ if(audioProperties){
string duration = boost::str(boost::format(UTF("%1%"))%audioProperties->length()); string duration = boost::str(boost::format("%1%")%audioProperties->length());
this->SetTagValue("duration",duration,track); this->SetTagValue("duration",duration,track);
int bitrate( audioProperties->bitrate() ); int bitrate( audioProperties->bitrate() );
if(bitrate){ if(bitrate){
string temp( boost::str(boost::format(UTF("%1%"))%bitrate ) ); string temp( boost::str(boost::format("%1%")%bitrate ) );
this->SetTagValue("bitrate",temp,track); this->SetTagValue("bitrate",temp,track);
} }
int channels( audioProperties->channels() ); int channels( audioProperties->channels() );
if(channels){ if(channels){
string temp( boost::str(boost::format(UTF("%1%"))%channels ) ); string temp( boost::str(boost::format("%1%")%channels ) );
this->SetTagValue("channels",temp,track); this->SetTagValue("channels",temp,track);
} }
} }

View File

@ -79,15 +79,15 @@ class TaglibPlugin : public musik::core::IPlugin
void Destroy() { delete this; }; void Destroy() { delete this; };
const char* Name(){ const char* Name(){
return UTF("Taglib 1.5 plugin"); return "Taglib 1.5 plugin";
}; };
const char* Version(){ const char* Version(){
return UTF("0.1"); return "0.1";
}; };
const char* Author(){ const char* Author(){
return UTF("Daniel <20>nnerby"); return "Daniel <20>nnerby";
}; };
}; };

View File

@ -228,7 +228,10 @@ void WaveOut::SetFormat(IBuffer *buffer) {
this->waveFormat.dwChannelMask = speakerConfig; this->waveFormat.dwChannelMask = speakerConfig;
this->waveFormat.SubFormat = KSDATAFORMAT_SUBTYPE_IEEE_FLOAT; this->waveFormat.SubFormat = KSDATAFORMAT_SUBTYPE_IEEE_FLOAT;
/* create the output device */ /* create the output device. note that we use a thread instead of a simple callback
here. that's because processing a buffer after calling waveOutReset() can lead to
crashes; so we can use a thread and ensure it's shut down before resetting the
output device, making it impossible to reach this condition. */
int openResult = waveOutOpen( int openResult = waveOutOpen(
&this->waveHandle, &this->waveHandle,
WAVE_MAPPER, WAVE_MAPPER,

View File

@ -45,9 +45,9 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserv
class WaveOutPlugin : public musik::core::IPlugin { class WaveOutPlugin : public musik::core::IPlugin {
void Destroy() { delete this; }; void Destroy() { delete this; };
const char* Name() { return UTF("WaveOut output plugin"); }; const char* Name() { return "WaveOut output plugin"; };
const char* Version() { return UTF("1"); }; const char* Version() { return "1"; };
const char* Author() { return UTF("Bj<EFBFBD>rn Olievier"); }; const char* Author() { return "Bj<EFBFBD>rn Olievier"; };
}; };
extern "C" __declspec(dllexport) musik::core::IPlugin* GetPlugin() { extern "C" __declspec(dllexport) musik::core::IPlugin* GetPlugin() {

View File

@ -51,7 +51,7 @@
////////////////////////////////////////// //////////////////////////////////////////
std::string musik::core::GetPluginDirectory(){ std::string musik::core::GetPluginDirectory(){
std::string sDirectory(GetApplicationDirectory()); std::string sDirectory(GetApplicationDirectory());
sDirectory.append(UTF("plugins/")); sDirectory.append("plugins/");
return sDirectory; return sDirectory;
} }
@ -87,7 +87,7 @@ std::string musik::core::GetDataDirectory(){
delete [] sBuffer; delete [] sBuffer;
#endif #endif
directory.append(UTF("/mC2/")); directory.append("/mC2/");
// Create folder if it does not exist // Create folder if it does not exist
boost::filesystem::path oFolder(directory); boost::filesystem::path oFolder(directory);

View File

@ -86,7 +86,7 @@ const char* GenericTrack::GetValue(const char* metakey){
if(metaKey=="title"){ if(metaKey=="title"){
// In case there is no title // In case there is no title
std::string::size_type lastSlash = this->uri.find_last_of(UTF("/\\")); std::string::size_type lastSlash = this->uri.find_last_of("/\\");
if(lastSlash!=std::string::npos){ if(lastSlash!=std::string::npos){
static std::string tempString; static std::string tempString;
tempString = this->uri.substr(lastSlash+1); tempString = this->uri.substr(lastSlash+1);

View File

@ -89,22 +89,22 @@ std::string Indexer::GetStatus(){
std::string sStatus; std::string sStatus;
switch(this->status){ switch(this->status){
case 1: case 1:
sStatus = boost::str(boost::format(UTF("Counting files: %1%"))%this->nofFiles ); sStatus = boost::str(boost::format("Counting files: %1%")%this->nofFiles );
break; break;
case 2: case 2:
sStatus = boost::str(boost::format(UTF("Indexing: %.2f"))%(this->progress*100)) + UTF("%"); sStatus = boost::str(boost::format("Indexing: %.2f") % (this->progress*100)) + "%";
break; break;
case 3: case 3:
sStatus = boost::str(boost::format(UTF("Removing old files: %.2f"))%(this->progress*100)) + UTF("%"); sStatus = boost::str(boost::format("Removing old files: %.2f") % (this->progress*100)) + "%";
break; break;
case 4: case 4:
sStatus = UTF("Cleaning up."); sStatus = "Cleaning up.";
break; break;
case 5: case 5:
sStatus = UTF("Optimizing."); sStatus = "Optimizing.";
break; break;
case 6: case 6:
sStatus = boost::str(boost::format(UTF("Analyzing: %.2f%% (current %.1f%%)"))%(100.0*this->progress/(double)this->nofFiles)%(this->progress2*100.0)); sStatus = boost::str(boost::format("Analyzing: %.2f%% (current %.1f%%)")%(100.0*this->progress/(double)this->nofFiles)%(this->progress2*100.0));
break; break;
} }
return sStatus; return sStatus;
@ -148,8 +148,8 @@ bool Indexer::Restarted(){
void Indexer::AddPath(std::string sPath){ void Indexer::AddPath(std::string sPath){
boost::filesystem::path oPath(sPath); boost::filesystem::path oPath(sPath);
sPath = oPath.string(); // Fix pathname for slash/backslash sPath = oPath.string(); // Fix pathname for slash/backslash
if(sPath.substr(sPath.size()-1,1)!=UTF("/")){ if(sPath.substr(sPath.size()-1,1)!="/"){
sPath += UTF("/"); sPath += "/";
} }
Indexer::_AddRemovePath addPath; Indexer::_AddRemovePath addPath;
@ -457,7 +457,7 @@ void Indexer::SyncDirectory(std::string &sFolder,DBID iParentFolderId,DBID iPath
} }
} }
catch(...){ catch(...){
// std::wcout << UTF("ERROR ") << sFolder << std::endl; // std::wcout << "ERROR " << sFolder << std::endl;
} }
} }
@ -534,7 +534,7 @@ bool Indexer::Startup(std::string setLibraryPath){
this->libraryPath = setLibraryPath; this->libraryPath = setLibraryPath;
// Create thumbnail cache directory // Create thumbnail cache directory
boost::filesystem::path thumbPath(this->libraryPath+UTF("thumbs/")); boost::filesystem::path thumbPath(this->libraryPath+"thumbs/");
if(!boost::filesystem::exists(thumbPath)){ if(!boost::filesystem::exists(thumbPath)){
boost::filesystem::create_directories(thumbPath); boost::filesystem::create_directories(thumbPath);
} }

View File

@ -146,7 +146,7 @@ bool IndexerTrack::CompareDBAndFileInfo(
this->SetValue("path", file.string().c_str()); this->SetValue("path", file.string().c_str());
this->SetValue("filename", file.leaf().string().c_str()); this->SetValue("filename", file.leaf().string().c_str());
size_t lastDot = file.leaf().string().find_last_of(UTF(".")); size_t lastDot = file.leaf().string().find_last_of(".");
if(lastDot != std::string::npos){ if(lastDot != std::string::npos){
this->SetValue("extension",file.leaf().string().substr(lastDot+1).c_str()); this->SetValue("extension",file.leaf().string().substr(lastDot+1).c_str());
} }
@ -266,7 +266,7 @@ bool IndexerTrack::Save(db::Connection &dbConnection, std::string libraryDirecto
// Second, add to the visual genre // Second, add to the visual genre
if(count!=0){ if(count!=0){
visualGenres += UTF(", "); visualGenres += ", ";
} }
visualGenres += genres.first->second; visualGenres += genres.first->second;
@ -300,7 +300,7 @@ bool IndexerTrack::Save(db::Connection &dbConnection, std::string libraryDirecto
// Second, add to the visual artist // Second, add to the visual artist
if(count!=0){ if(count!=0){
visualArtists += UTF(", "); visualArtists += ", ";
} }
visualArtists += artists.first->second; visualArtists += artists.first->second;
@ -323,7 +323,7 @@ bool IndexerTrack::Save(db::Connection &dbConnection, std::string libraryDirecto
db::CachedStatement stmt("SELECT id FROM albums WHERE name=?",dbConnection); db::CachedStatement stmt("SELECT id FROM albums WHERE name=?",dbConnection);
const char *album=this->GetValue("album"); const char *album=this->GetValue("album");
if(album==NULL){ if(album==NULL){
album=UTF(""); album="";
} }
stmt.BindTextUTF(0,album); stmt.BindTextUTF(0,album);
@ -371,15 +371,15 @@ bool IndexerTrack::Save(db::Connection &dbConnection, std::string libraryDirecto
// Save the file // Save the file
std::string filename = std::string filename =
libraryDirectory + libraryDirectory +
UTF("thumbs/") + "thumbs/" +
boost::lexical_cast<std::string>(thumbnailId) + boost::lexical_cast<std::string>(thumbnailId) +
UTF(".jpg"); ".jpg";
#ifdef WIN32 #ifdef WIN32
std::wstring wfilename = u8to16(filename); std::wstring wfilename = u8to16(filename);
FILE *thumbFile = _wfopen(wfilename.c_str(), _T("wb")); FILE *thumbFile = _wfopen(wfilename.c_str(), _T("wb"));
#else #else
FILE *thumbFile = fopen(filename.c_str(),UTF("wb")); FILE *thumbFile = fopen(filename.c_str(),"wb");
#endif #endif
fwrite(this->meta->thumbnailData,sizeof(char),this->meta->thumbnailSize,thumbFile); fwrite(this->meta->thumbnailData,sizeof(char),this->meta->thumbnailSize,thumbFile);
fclose(thumbFile); fclose(thumbFile);

View File

@ -135,7 +135,7 @@ std::string Library::Base::GetLibraryDirectory(){
std::string directory( musik::core::GetDataDirectory() ); std::string directory( musik::core::GetDataDirectory() );
if(!this->identifier.empty()){ if(!this->identifier.empty()){
directory.append(this->identifier+UTF("/")); directory.append(this->identifier+"/");
} }
boost::filesystem::path oFolder(directory); boost::filesystem::path oFolder(directory);
@ -157,7 +157,7 @@ std::string Library::Base::GetLibraryDirectory(){
////////////////////////////////////////// //////////////////////////////////////////
std::string Library::Base::GetDBPath(){ std::string Library::Base::GetDBPath(){
std::string sPath = this->GetLibraryDirectory(); std::string sPath = this->GetLibraryDirectory();
sPath.append(UTF("musik.db")); sPath.append("musik.db");
return sPath; return sPath;
} }
@ -733,7 +733,7 @@ void Library::Base::CreateDatabase(db::Connection &db){
///get the HTTP-address to the tracks ///get the HTTP-address to the tracks
////////////////////////////////////////// //////////////////////////////////////////
std::string Library::Base::BasePath(){ std::string Library::Base::BasePath(){
return UTF(""); return "";
} }
LibraryPtr Library::Base::GetSelfPtr(){ LibraryPtr Library::Base::GetSelfPtr(){

View File

@ -97,7 +97,7 @@ Library::Remote::~Remote(void){
///about the Indexer. ///about the Indexer.
////////////////////////////////////////// //////////////////////////////////////////
std::string Library::Remote::GetInfo(){ std::string Library::Remote::GetInfo(){
return UTF(""); return "";
} }
@ -129,10 +129,10 @@ void Library::Remote::ReadThread(){
{ {
Preferences prefs("Connection",this->Name().c_str()); Preferences prefs("Connection",this->Name().c_str());
this->address = prefs.GetString("address",UTF("localhost")); this->address = prefs.GetString("address","localhost");
this->port = prefs.GetString("port",UTF("10543")); this->port = prefs.GetString("port","10543");
this->username = prefs.GetString("username",UTF("")); this->username = prefs.GetString("username","");
this->password = prefs.GetString("password",UTF("")); this->password = prefs.GetString("password","");
} }
boost::asio::ip::tcp::resolver resolver(this->ioService); boost::asio::ip::tcp::resolver resolver(this->ioService);
@ -341,12 +341,12 @@ void Library::Remote::Exit(){
///get the HTTP-address to the tracks ///get the HTTP-address to the tracks
////////////////////////////////////////// //////////////////////////////////////////
std::string Library::Remote::BasePath(){ std::string Library::Remote::BasePath(){
std:: string path(UTF("http://")); std:: string path("http://");
boost::asio::ip::tcp::endpoint endPoint = this->socket.remote_endpoint(); boost::asio::ip::tcp::endpoint endPoint = this->socket.remote_endpoint();
boost::asio::ip::address address = endPoint.address(); boost::asio::ip::address address = endPoint.address();
path += address.to_string(); path += address.to_string();
path += UTF(":") + this->httpPort + UTF("/"); path += ":" + this->httpPort + "/";
return path; return path;
} }

View File

@ -59,7 +59,7 @@ LibraryFactory& LibraryFactory::Instance(){
LibraryFactory::LibraryFactory(void){ LibraryFactory::LibraryFactory(void){
// Connect to the settings.db // Connect to the settings.db
std::string dataDir = GetDataDirectory(); std::string dataDir = GetDataDirectory();
std::string dbFile = GetDataDirectory() + UTF("settings.db"); std::string dbFile = GetDataDirectory() + "settings.db";
musik::core::db::Connection db; musik::core::db::Connection db;
db.Open(dbFile.c_str(),0,128); db.Open(dbFile.c_str(),0,128);
@ -74,7 +74,7 @@ LibraryFactory::LibraryFactory(void){
// If there are no libraries, add a LocalDB // If there are no libraries, add a LocalDB
if(this->libraries.empty()){ if(this->libraries.empty()){
this->CreateLibrary(UTF("Local Library"),LibraryFactory::LocalDB); this->CreateLibrary("Local Library",LibraryFactory::LocalDB);
} }
} }
@ -156,7 +156,7 @@ void LibraryFactory::RemoveLibrary(std::string name){
LibraryPtr LibraryFactory::CreateLibrary(std::string name,int type,bool startup){ LibraryPtr LibraryFactory::CreateLibrary(std::string name,int type,bool startup){
// Connect to the settings.db // Connect to the settings.db
std::string dataDir = GetDataDirectory(); std::string dataDir = GetDataDirectory();
std::string dbFile = GetDataDirectory() + UTF("settings.db"); std::string dbFile = GetDataDirectory() + "settings.db";
musik::core::db::Connection db; musik::core::db::Connection db;
db.Open(dbFile.c_str(),0,128); db.Open(dbFile.c_str(),0,128);

View File

@ -146,18 +146,18 @@ const char* LibraryTrack::URI(){
static std::string uri; static std::string uri;
if(this->meta){ if(this->meta){
uri = uri =
UTF("mcdb://") + "mcdb://" +
this->meta->library->Identifier() + this->meta->library->Identifier() +
UTF("/") + "/" +
boost::lexical_cast<std::string>(this->id); boost::lexical_cast<std::string>(this->id);
return uri.c_str(); return uri.c_str();
} }
else{ else{
uri = uri =
UTF("mcdb://") + "mcdb://" +
boost::lexical_cast<std::string>(this->libraryId) + boost::lexical_cast<std::string>(this->libraryId) +
UTF("/") + "/" +
boost::lexical_cast<std::string>(this->id); boost::lexical_cast<std::string>(this->id);
return uri.c_str(); return uri.c_str();

View File

@ -118,7 +118,7 @@ void NonLibraryTrackHelper::ThreadLoop(){
// check if this is a local file // check if this is a local file
if(musik::core::io::Factory::IsLocalFileStream(track->URL())){ if(musik::core::io::Factory::IsLocalFileStream(track->URL())){
std::string url(track->URL()); std::string url(track->URL());
std::string::size_type lastDot = url.find_last_of(UTF(".")); std::string::size_type lastDot = url.find_last_of(".");
if(lastDot != std::string::npos){ if(lastDot != std::string::npos){
track->SetValue("extension", url.substr(lastDot+1).c_str()); track->SetValue("extension", url.substr(lastDot+1).c_str());
} }

View File

@ -89,7 +89,7 @@ void PluginFactory::LoadPlugins(){
std::string sFile(oFile->path().string()); std::string sFile(oFile->path().string());
#ifdef WIN32 #ifdef WIN32
if(sFile.substr(sFile.size()-4)==UTF(".dll")){ // And a DLL if(sFile.substr(sFile.size()-4)==".dll"){ // And a DLL
std::wstring wpath = u8to16(sFile); std::wstring wpath = u8to16(sFile);
HMODULE oDLL = LoadLibrary(wpath.c_str()); HMODULE oDLL = LoadLibrary(wpath.c_str());
@ -112,7 +112,7 @@ void PluginFactory::LoadPlugins(){
} }
#else //GNU or other #else //GNU or other
if(sFile.substr(sFile.size()-3)==UTF(".so")){ // And a shared lib if(sFile.substr(sFile.size()-3)==".so"){ // And a shared lib
void* oDLL = dlopen(sFile.c_str(), RTLD_NOW); void* oDLL = dlopen(sFile.c_str(), RTLD_NOW);
char* err; char* err;
if ((err = dlerror()) != NULL) { if ((err = dlerror()) != NULL) {

View File

@ -123,7 +123,7 @@ Preferences::IO::Ptr Preferences::IO::Instance(){
Preferences::IO::IO(void){ Preferences::IO::IO(void){
boost::mutex::scoped_lock lock(this->mutex); boost::mutex::scoped_lock lock(this->mutex);
std::string dataDir = GetDataDirectory(); std::string dataDir = GetDataDirectory();
std::string dbFile = GetDataDirectory() + UTF("settings.db"); std::string dbFile = GetDataDirectory() + "settings.db";
this->db.Open(dbFile.c_str(),0,128); this->db.Open(dbFile.c_str(),0,128);
Preferences::CreateDB(this->db); Preferences::CreateDB(this->db);
@ -227,7 +227,7 @@ int Preferences::Setting::Value(int defaultValue){
std::string Preferences::Setting::Value(std::string defaultValue){ std::string Preferences::Setting::Value(std::string defaultValue){
switch(this->type){ switch(this->type){
case Setting::Bool: case Setting::Bool:
return this->valueBool?UTF("1"):UTF("0"); return this->valueBool ? "1" : "0";
break; break;
case Setting::Int: case Setting::Int:
try{ try{

View File

@ -434,9 +434,9 @@ bool TrackMetadata::SendResults(musik::core::xml::WriterNode &queryNode,Library:
bool TrackMetadata::ReceiveResults(musik::core::xml::ParserNode &queryNode,Library::Base *library){ bool TrackMetadata::ReceiveResults(musik::core::xml::ParserNode &queryNode,Library::Base *library){
bool requestPath( this->requestedFields.find("path")!=this->requestedFields.end() ); bool requestPath( this->requestedFields.find("path")!=this->requestedFields.end() );
std::string pathPrefix(library->BasePath()+UTF("track/?auth_key=")); std::string pathPrefix(library->BasePath()+"track/?auth_key=");
pathPrefix += library->AuthorizationKey(); pathPrefix += library->AuthorizationKey();
pathPrefix += UTF("&track_id="); pathPrefix += "&track_id=";
while(musik::core::xml::ParserNode trackNode=queryNode.ChildNode("t") ){ while(musik::core::xml::ParserNode trackNode=queryNode.ChildNode("t") ){
try{ try{

View File

@ -93,7 +93,7 @@ bool Server::Startup(){
} }
std::string Server::ServerIdentifier(){ std::string Server::ServerIdentifier(){
return UTF("server"); return "server";
} }
@ -102,8 +102,8 @@ void Server::ThreadLoop(){
musik::core::Preferences prefs("Server"); musik::core::Preferences prefs("Server");
// Get directory and database paths // Get directory and database paths
std::string directory( musik::core::GetDataDirectory()+this->ServerIdentifier()+UTF("/") ); std::string directory( musik::core::GetDataDirectory()+this->ServerIdentifier()+"/" );
std::string database(directory+UTF("musik.db")); std::string database(directory+"musik.db");
// Create directory if not existing // Create directory if not existing
boost::filesystem::path folder(directory); boost::filesystem::path folder(directory);

View File

@ -43,8 +43,8 @@
using namespace musik::core; using namespace musik::core;
TrackPtr TrackFactory::CreateTrack(std::string uri){ TrackPtr TrackFactory::CreateTrack(std::string uri){
if(uri.substr(0,7)==UTF("mcdb://")){ if(uri.substr(0,7)=="mcdb://"){
boost::regex reg(UTF("mcdb://([0-9]+)/([0-9]+)")); boost::regex reg("mcdb://([0-9]+)/([0-9]+)");
boost::smatch matches; boost::smatch matches;
if(boost::regex_match(uri,matches,reg)){ if(boost::regex_match(uri,matches,reg)){
return TrackPtr(new LibraryTrack( return TrackPtr(new LibraryTrack(

View File

@ -69,16 +69,6 @@ typedef UINT64 DBID;
typedef UINT64 VERSION; typedef UINT64 VERSION;
typedef UINT64 DBTIME; typedef UINT64 DBTIME;
//////////////////////////////////////////
///\brief
///The UTF macro is the text macro when writing texts in the code that
///should be utf encoded.
///
///\remarks
///We thought that the _T was a little bit too microsoft specific.
//////////////////////////////////////////
#define UTF(x) x
#ifdef WIN32 #ifdef WIN32
#define CopyFloat(dst, src, num) CopyMemory(dst, src, (num) * sizeof(float)) #define CopyFloat(dst, src, num) CopyMemory(dst, src, (num) * sizeof(float))
#else #else

View File

@ -79,7 +79,7 @@ bool LocalFileStream::Open(const char *filename,unsigned int options){
this->filesize = (long)boost::filesystem::file_size(file); this->filesize = (long)boost::filesystem::file_size(file);
this->extension = file.extension().string(); this->extension = file.extension().string();
this->file = UTFFopen(filename,UTF("rb")); this->file = UTFFopen(filename,"rb");
this->fd = new boost::iostreams::file_descriptor(file); this->fd = new boost::iostreams::file_descriptor(file);
this->fileStream = new boost::iostreams::stream<boost::iostreams::file_descriptor>(*this->fd); this->fileStream = new boost::iostreams::stream<boost::iostreams::file_descriptor>(*this->fd);
this->fileStream->exceptions(std::ios_base::eofbit | std::ios_base::failbit | std::ios_base::badbit); this->fileStream->exceptions(std::ios_base::eofbit | std::ios_base::failbit | std::ios_base::badbit);

View File

@ -59,7 +59,7 @@ using namespace musik::core::server;
Connection::Connection(boost::asio::io_service &ioService,musik::core::Server *server) Connection::Connection(boost::asio::io_service &ioService,musik::core::Server *server)
:socket(ioService) :socket(ioService)
,Base(UTF("Server"),0) ,Base("Server",0)
,server(server) ,server(server)
,salt(musik::core::Crypt::GenerateSalt()) ,salt(musik::core::Crypt::GenerateSalt())
{ {
@ -342,7 +342,7 @@ void Connection::CancelCurrentQuery( ){
} }
std::string Connection::GetInfo(){ std::string Connection::GetInfo(){
return UTF(""); return "";
} }
void Connection::Exit(){ void Connection::Exit(){

View File

@ -88,7 +88,7 @@ void ConsoleUI::Run()
while (!this->shouldQuit) while (!this->shouldQuit)
{ {
this->PrintCommands(); this->PrintCommands();
cout << UTF("Enter command: "); cout << "Enter command: ";
std::getline(cin, command); // Need getline to handle spaces! std::getline(cin, command); // Need getline to handle spaces!
this->ProcessCommand(command); this->ProcessCommand(command);
} }
@ -114,38 +114,38 @@ void ConsoleUI::ProcessCommand(std::string commandString)
boost::algorithm::split(args, commandString, boost::is_any_of(" ")); boost::algorithm::split(args, commandString, boost::is_any_of(" "));
std::string command = args.size() > 0 ? args[0] : UTF(""); std::string command = args.size() > 0 ? args[0] : "";
args.erase(args.begin()); args.erase(args.begin());
if (command == UTF("p")) if (command == "p")
{ {
this->PlayFile(args); this->PlayFile(args);
} }
else if (command == UTF("pa")) else if (command == "pa")
{ {
this->Pause(); this->Pause();
} }
else if (command == UTF("s")) else if (command == "s")
{ {
this->Stop(args); this->Stop(args);
} }
else if (command == UTF("seek")) else if (command == "seek")
{ {
this->SetPosition(args); this->SetPosition(args);
} }
else if (command == UTF("l")) else if (command == "l")
{ {
this->ListPlaying(); this->ListPlaying();
} }
else if (command == UTF("lp")) else if (command == "lp")
{ {
this->ListPlugins(); this->ListPlugins();
} }
else if (command == UTF("v")) else if (command == "v")
{ {
this->SetVolume(args); this->SetVolume(args);
} }
else if (command == UTF("q")) else if (command == "q")
{ {
this->Quit(); this->Quit();
} }

View File

@ -50,11 +50,11 @@ DummyAudioEventHandler::~DummyAudioEventHandler()
void DummyAudioEventHandler::PrintEvent(std::string s) void DummyAudioEventHandler::PrintEvent(std::string s)
{ {
this->cui->Print(UTF("EVENT: " + s + UTF("\n"))); this->cui->Print("EVENT: " + s + "\n");
} }
void DummyAudioEventHandler::OnMixpointReached() void DummyAudioEventHandler::OnMixpointReached()
{ {
this->PrintEvent(UTF("Mix point reached")); this->PrintEvent("Mix point reached");
//this->cui->StartNew(); // Endless test loop //this->cui->StartNew(); // Endless test loop
} }

View File

@ -56,19 +56,19 @@ private: ConsoleUI* cui; // TODO: should probably be interface
private: void PrintEvent(std::string s); private: void PrintEvent(std::string s);
// Slots // Slots
public: void OnPlaybackAlmostEnded() { this->PrintEvent(UTF("Playback almost done")); }; public: void OnPlaybackAlmostEnded() { this->PrintEvent("Playback almost done"); };
public: void OnPlaybackStartedOk() { this->PrintEvent(UTF("Playback started OK")); }; public: void OnPlaybackStartedOk() { this->PrintEvent("Playback started OK"); };
public: void OnPlaybackStartedFail() { this->PrintEvent(UTF("Playback started FAIL")); }; public: void OnPlaybackStartedFail() { this->PrintEvent("Playback started FAIL"); };
public: void OnPlaybackStoppedOk() { this->PrintEvent(UTF("Playback stopped OK")); }; public: void OnPlaybackStoppedOk() { this->PrintEvent("Playback stopped OK"); };
public: void OnPlaybackStoppedFail() { this->PrintEvent(UTF("Playback stopped FAIL")); }; public: void OnPlaybackStoppedFail() { this->PrintEvent("Playback stopped FAIL"); };
public: void OnPlaybackInterrupted() { this->PrintEvent(UTF("Playback interrupted")); }; public: void OnPlaybackInterrupted() { this->PrintEvent("Playback interrupted"); };
public: void OnVolumeChangedOk() { this->PrintEvent(UTF("Volume changed OK")); }; public: void OnVolumeChangedOk() { this->PrintEvent("Volume changed OK"); };
public: void OnVolumeChangedFail() { this->PrintEvent(UTF("Volume changed FAIL")); }; public: void OnVolumeChangedFail() { this->PrintEvent("Volume changed FAIL"); };
public: void OnStreamOpenOk() { this->PrintEvent(UTF("Stream open OK")); }; public: void OnStreamOpenOk() { this->PrintEvent("Stream open OK"); };
public: void OnStreamOpenFail() { this->PrintEvent(UTF("Stream open FAIL")); }; public: void OnStreamOpenFail() { this->PrintEvent("Stream open FAIL"); };
public: void OnMixpointReached() ; public: void OnMixpointReached() ;
public: void OnSetPositionOk() { this->PrintEvent(UTF("Set position OK")); }; public: void OnSetPositionOk() { this->PrintEvent("Set position OK"); };
public: void OnSetPositionFail() { this->PrintEvent(UTF("Set position FAIL")); }; public: void OnSetPositionFail() { this->PrintEvent("Set position FAIL"); };
}; };
}} // NS }} // NS