mirror of
https://github.com/clangen/musikcube.git
synced 2024-10-02 04:52:32 +00:00
Got musikSquare to compile and run :D. Now to make it do things...
This commit is contained in:
parent
66c63bc9ee
commit
ca4e7068d1
@ -64,5 +64,5 @@ add_subdirectory(src/3rdparty)
|
||||
add_subdirectory(src/core)
|
||||
add_subdirectory(src/contrib)
|
||||
#add_subdirectory(src/server)
|
||||
#add_subdirectory(src/square)
|
||||
add_subdirectory(src/square)
|
||||
#add_subdirectory(src/cube)
|
||||
|
@ -42,9 +42,10 @@
|
||||
#include <core/IPlugin.h>
|
||||
#include <core/PluginFactory.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace musik::square;
|
||||
|
||||
//enum audioEventHandler;
|
||||
|
||||
ConsoleUI::ConsoleUI()
|
||||
: shouldQuit(false)
|
||||
, audioEventHandler(this)
|
||||
@ -55,10 +56,12 @@ ConsoleUI::ConsoleUI()
|
||||
// this->transport.EventPlaybackStoppedOk.connect(&audioEventHandler, &DummyAudioEventHandler::OnPlaybackStoppedOk);
|
||||
// this->transport.EventPlaybackStoppedFail.connect(&audioEventHandler, &DummyAudioEventHandler::OnPlaybackStoppedFail);
|
||||
|
||||
this->transport.EventVolumeChangedOk.connect(&audioEventHandler, &DummyAudioEventHandler::OnVolumeChangedOk);
|
||||
this->transport.EventVolumeChangedFail.connect(&audioEventHandler, &DummyAudioEventHandler::OnVolumeChangedFail);
|
||||
// this->transport.EventVolumeChangedOk.connect(&audioEventHandler, &DummyAudioEventHandler::OnVolumeChangedOk);
|
||||
// this->transport.EventVolumeChangedFail.connect(&audioEventHandler, &DummyAudioEventHandler::OnVolumeChangedFail);
|
||||
|
||||
this->transport.EventMixpointReached.connect(&audioEventHandler, &DummyAudioEventHandler::OnMixpointReached);
|
||||
// this->transport.EventMixpointReached.connect(&audioEventHandler, &DummyAudioEventHandler::OnMixpointReached);
|
||||
|
||||
this->transport.PlaybackStarted.connect(&this->audioEventHandler, &DummyAudioEventHandler::OnPlaybackStartedOk);
|
||||
}
|
||||
|
||||
ConsoleUI::~ConsoleUI()
|
||||
@ -71,7 +74,7 @@ void ConsoleUI::Print(utfstring s)
|
||||
|
||||
utfcout << "\n*******************************\n\n";
|
||||
utfcout << s;
|
||||
utfcout << "\n*******************************\n" << endl;
|
||||
utfcout << "\n*******************************\n" << std::endl;
|
||||
}
|
||||
|
||||
void ConsoleUI::Run()
|
||||
@ -98,7 +101,7 @@ void ConsoleUI::PrintCommands()
|
||||
utfcout << "\tlp: list loaded plugins\n";
|
||||
utfcout << "\tv <p>: set volume to p%\n";
|
||||
utfcout << "\tq: quit";
|
||||
utfcout << endl;
|
||||
utfcout << std::endl;
|
||||
}
|
||||
|
||||
void ConsoleUI::ProcessCommand(utfstring commandString)
|
||||
@ -109,30 +112,30 @@ void ConsoleUI::ProcessCommand(utfstring commandString)
|
||||
|
||||
split(args, commandString, is_any_of(" "));
|
||||
|
||||
utfstring command = args.size() > 0 ? args[0] : _T("");
|
||||
utfstring command = args.size() > 0 ? args[0] : UTF("");
|
||||
args.erase(args.begin());
|
||||
|
||||
if (command == _T("p"))
|
||||
if (command == UTF("p"))
|
||||
{
|
||||
this->PlayFile(args);
|
||||
}
|
||||
else if (command == _T("s"))
|
||||
else if (command == UTF("s"))
|
||||
{
|
||||
this->Stop(args);
|
||||
}
|
||||
else if (command == _T("l"))
|
||||
/*else if (command == UTF("l"))
|
||||
{
|
||||
this->ListPlaying();
|
||||
}
|
||||
else if (command == _T("lp"))
|
||||
}*/
|
||||
else if (command == UTF("lp"))
|
||||
{
|
||||
this->ListPlugins();
|
||||
}
|
||||
else if (command == _T("v"))
|
||||
else if (command == UTF("v"))
|
||||
{
|
||||
this->SetVolume(args);
|
||||
}
|
||||
else if (command == _T("q"))
|
||||
else if (command == UTF("q"))
|
||||
{
|
||||
this->Quit();
|
||||
}
|
||||
@ -151,7 +154,7 @@ void ConsoleUI::PlayFile(Args args)
|
||||
}
|
||||
else
|
||||
{
|
||||
filename = _T("C:\\temp\\musik\\ding.mp3"); //TODO: remove. For quick testing only
|
||||
filename = UTF("C:\\temp\\musik\\ding.mp3"); //TODO: remove. For quick testing only
|
||||
}
|
||||
|
||||
int repeat = 1;
|
||||
@ -174,7 +177,7 @@ void ConsoleUI::PlayFile(Args args)
|
||||
// transport.Start(filename.c_str()); //TODO: fix to use TrackPtr
|
||||
if (delay)
|
||||
{
|
||||
Sleep(delay);
|
||||
sleep(delay);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -188,27 +191,28 @@ void ConsoleUI::Stop()
|
||||
{
|
||||
transport.Stop();
|
||||
}
|
||||
|
||||
/*
|
||||
void ConsoleUI::ListPlaying()
|
||||
{
|
||||
AudioStreamOverview overview = transport.StreamsOverview();
|
||||
/*AudioStreamOverview overview = transport.StreamsOverview();
|
||||
AudioStreamOverviewIterator it;
|
||||
|
||||
|
||||
for (it = overview.begin(); it != overview.end(); ++it)
|
||||
{
|
||||
utfcout << *it << '\n';
|
||||
}
|
||||
|
||||
utfcout << "------------------\n";
|
||||
utfcout << transport.NumOfStreams() << " playing" << endl;
|
||||
}
|
||||
utfcout << transport.NumOfStreams() << " playing" << std::std::endl;
|
||||
}*/
|
||||
|
||||
void ConsoleUI::ListPlugins()
|
||||
{
|
||||
using musik::core::IPlugin;
|
||||
using musik::core::PluginFactory;
|
||||
|
||||
typedef std::vector<boost::shared_ptr<IPlugin>> PluginList;
|
||||
typedef std::vector<boost::shared_ptr<IPlugin> > PluginList;
|
||||
typedef PluginFactory::NullDeleter<IPlugin> Deleter;
|
||||
|
||||
PluginList plugins =
|
||||
@ -247,6 +251,7 @@ void ConsoleUI::ShutDown()
|
||||
{
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
/*static*/ DWORD WINAPI ConsoleUI::ThreadRun(LPVOID param)
|
||||
{
|
||||
ConsoleUI* instance = (ConsoleUI*)param;
|
||||
@ -254,6 +259,7 @@ void ConsoleUI::ShutDown()
|
||||
delete instance;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
void ConsoleUI::StartNew()
|
||||
{
|
||||
|
@ -81,7 +81,10 @@ private: DummyAudioEventHandler audioEventHandler;
|
||||
private: boost::mutex mutex;
|
||||
|
||||
private: void ShutDown();
|
||||
|
||||
#ifdef WIN32
|
||||
public: static DWORD WINAPI ThreadRun(LPVOID param);
|
||||
#endif
|
||||
|
||||
public: void StartNew();
|
||||
};
|
||||
|
@ -50,11 +50,11 @@ DummyAudioEventHandler::~DummyAudioEventHandler()
|
||||
|
||||
void DummyAudioEventHandler::PrintEvent(utfstring s)
|
||||
{
|
||||
this->cui->Print(_T("EVENT: " + s + _T("\n")));
|
||||
this->cui->Print(UTF("EVENT: " + s + UTF("\n")));
|
||||
}
|
||||
|
||||
void DummyAudioEventHandler::OnMixpointReached()
|
||||
{
|
||||
this->PrintEvent(_T("Mix point reached"));
|
||||
this->PrintEvent(UTF("Mix point reached"));
|
||||
//this->cui->StartNew(); // Endless test loop
|
||||
}
|
@ -35,6 +35,8 @@
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <sigslot/sigslot.h>
|
||||
@ -43,7 +45,7 @@ namespace musik { namespace square {
|
||||
|
||||
class ConsoleUI;
|
||||
|
||||
enum AudioStreamEvent;
|
||||
//enum AudioStreamEvent;
|
||||
|
||||
class DummyAudioEventHandler : public sigslot::has_slots<>
|
||||
{
|
||||
@ -54,18 +56,18 @@ private: ConsoleUI* cui; // TODO: should probably be interface
|
||||
private: void PrintEvent(utfstring s);
|
||||
|
||||
// Slots
|
||||
public: void OnPlaybackStartedOk() { this->PrintEvent(_T("Playback started OK")); };
|
||||
public: void OnPlaybackStartedFail() { this->PrintEvent(_T("Playback started FAIL")); };
|
||||
public: void OnPlaybackStoppedOk() { this->PrintEvent(_T("Playback stopped OK")); };
|
||||
public: void OnPlaybackStoppedFail() { this->PrintEvent(_T("Playback stopped FAIL")); };
|
||||
public: void OnPlaybackInterrupted() { this->PrintEvent(_T("Playback interrupted")); };
|
||||
public: void OnVolumeChangedOk() { this->PrintEvent(_T("Volume changed OK")); };
|
||||
public: void OnVolumeChangedFail() { this->PrintEvent(_T("Volume changed FAIL")); };
|
||||
public: void OnStreamOpenOk() { this->PrintEvent(_T("Stream open OK")); };
|
||||
public: void OnStreamOpenFail() { this->PrintEvent(_T("Stream open FAIL")); };
|
||||
public: void OnPlaybackStartedOk() { this->PrintEvent(UTF("Playback started OK")); };
|
||||
public: void OnPlaybackStartedFail() { this->PrintEvent(UTF("Playback started FAIL")); };
|
||||
public: void OnPlaybackStoppedOk() { this->PrintEvent(UTF("Playback stopped OK")); };
|
||||
public: void OnPlaybackStoppedFail() { this->PrintEvent(UTF("Playback stopped FAIL")); };
|
||||
public: void OnPlaybackInterrupted() { this->PrintEvent(UTF("Playback interrupted")); };
|
||||
public: void OnVolumeChangedOk() { this->PrintEvent(UTF("Volume changed OK")); };
|
||||
public: void OnVolumeChangedFail() { this->PrintEvent(UTF("Volume changed FAIL")); };
|
||||
public: void OnStreamOpenOk() { this->PrintEvent(UTF("Stream open OK")); };
|
||||
public: void OnStreamOpenFail() { this->PrintEvent(UTF("Stream open FAIL")); };
|
||||
public: void OnMixpointReached() ;
|
||||
public: void OnSetPositionOk() { this->PrintEvent(_T("Set position OK")); };
|
||||
public: void OnSetPositionFail() { this->PrintEvent(_T("Set position FAIL")); };
|
||||
public: void OnSetPositionOk() { this->PrintEvent(UTF("Set position OK")); };
|
||||
public: void OnSetPositionFail() { this->PrintEvent(UTF("Set position FAIL")); };
|
||||
};
|
||||
|
||||
}} // NS
|
||||
|
@ -44,17 +44,17 @@
|
||||
namespace std
|
||||
{
|
||||
#if defined UNICODE || defined _UNICODE
|
||||
# define utfcerr wcerr
|
||||
# define utfcin wcin
|
||||
# define utfclog wclog
|
||||
# define utfcout wcout
|
||||
# define utfcerr std::wcerr
|
||||
# define utfcin std::wcin
|
||||
# define utfclog std::wclog
|
||||
# define utfcout std::wcout
|
||||
|
||||
#else // defined UNICODE || defined _UNICODE
|
||||
|
||||
# define utfcerr cerr
|
||||
# define utfcin cin
|
||||
# define utfclog clog
|
||||
# define utfcout cout
|
||||
# define utfcerr std::cerr
|
||||
# define utfcin std::cin
|
||||
# define utfclog std::clog
|
||||
# define utfcout std::cout
|
||||
|
||||
#endif // defined UNICODE || defined _UNICODE
|
||||
} // namespace std
|
||||
|
@ -37,7 +37,11 @@
|
||||
|
||||
using namespace musik::square;
|
||||
|
||||
#ifdef WIN32
|
||||
int _tmain(int argc, _TCHAR* argv[])
|
||||
#else
|
||||
int main(int argc, char* argv[])
|
||||
#endif
|
||||
{
|
||||
ConsoleUI* instance = new ConsoleUI();
|
||||
instance->Run();
|
||||
|
@ -5,9 +5,15 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
#include <windows.h>
|
||||
|
||||
#include <vld/vld.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user