Fixed macos compile.

This commit is contained in:
Casey Langen 2016-12-23 18:58:18 -08:00
parent 1f0b306987
commit 40e9fc90c3
6 changed files with 21 additions and 12 deletions

View File

@ -241,6 +241,10 @@ void CoreAudioOut::SetVolume(double volume) {
}
}
double CoreAudioOut::GetVolume() {
return this->volume;
}
void CoreAudioOut::Stop() {
AudioQueueRef queue = NULL;

View File

@ -64,6 +64,7 @@ class CoreAudioOut : public musik::core::sdk::IOutput {
virtual void Pause();
virtual void Resume();
virtual void SetVolume(double volume);
virtual double GetVolume();
virtual void Stop();
virtual double Latency() { return 0.0; }

View File

@ -1,6 +1,8 @@
set(CORE_SOURCES
./debug.cpp
./audio/Buffer.cpp
./audio/Crossfader.cpp
./audio/CrossfadeTransport.cpp
./audio/GaplessTransport.cpp
./audio/Outputs.cpp
./audio/Player.cpp

View File

@ -336,7 +336,7 @@ void CrossfadeTransport::PlayerContext::Reset(
void CrossfadeTransport::PlayerContext::TransferTo(PlayerContext& to) {
to.player = player;
to.output = output;
this->player = player;
this->player = nullptr;
this->output.reset();
}

View File

@ -60,8 +60,8 @@ Crossfader::Crossfader(ITransport& transport)
this->quit = false;
this->paused = false;
this->thread = std::make_unique<std::thread>(
std::bind(&Crossfader::ThreadLoop, this));
this->thread.reset(new std::thread(
std::bind(&Crossfader::ThreadLoop, this)));
}
Crossfader::~Crossfader() {
@ -115,8 +115,8 @@ void Crossfader::Pause() {
std::for_each(
this->contextList.begin(),
this->contextList.end(),
[](auto it) {
it->output->Pause();
[](FadeContextPtr context) {
context->output->Pause();
});
this->messageQueue.Remove(this, MESSAGE_TICK);
@ -130,8 +130,8 @@ void Crossfader::Resume() {
std::for_each(
this->contextList.begin(),
this->contextList.end(),
[](auto it) {
it->output->Resume();
[](FadeContextPtr context) {
context->output->Resume();
});
this->messageQueue.Post(
@ -167,10 +167,10 @@ void Crossfader::ProcessMessage(IMessage &message) {
float outputVolume = globalVolume * percent;
#if 1
std::string dir = (fade->direction == FadeIn) ? "in" : "out";
std::string dbg = boost::str(boost::format("%s %f\n") % dir % outputVolume);
OutputDebugStringA(dbg.c_str());
#if 0
std::string dir = (fade->direction == FadeIn) ? "in" : "out";
std::string dbg = boost::str(boost::format("%s %f\n") % dir % outputVolume);
OutputDebugStringA(dbg.c_str());
#endif
fade->output->SetVolume(outputVolume);

View File

@ -83,10 +83,12 @@ namespace musik { namespace core { namespace audio {
long ticksTotal;
};
using FadeContextPtr = std::shared_ptr<FadeContext>;
std::mutex contextListLock;
std::unique_ptr<std::thread> thread;
musik::core::runtime::MessageQueue messageQueue;
std::list<std::shared_ptr<FadeContext>> contextList;
std::list<FadeContextPtr> contextList;
std::atomic<bool> quit, paused;
ITransport& transport;
};