diff --git a/src/contrib/esdout/EsdOut.cpp b/src/contrib/esdout/EsdOut.cpp index ca175cd05..bb3099a68 100644 --- a/src/contrib/esdout/EsdOut.cpp +++ b/src/contrib/esdout/EsdOut.cpp @@ -36,6 +36,9 @@ EsdOut::EsdOut() :waveHandle(NULL) ,maxBuffers(32) ,currentVolume(1.0) + ,currentBits(ESD_BITS16) + ,currentMode(ESD_STEREO) + ,currentFunc(ESD_PLAY) ,addToRemovedBuffers(false) ,device("default") //,output(NULL) @@ -43,6 +46,7 @@ EsdOut::EsdOut() #ifdef _DEBUG std::cerr << "EsdOut::EsdOut() called" << std::endl; #endif + const char* host; } EsdOut::~EsdOut(){ @@ -192,6 +196,12 @@ void EsdOut::SetFormat(IBuffer *buffer){ this->currentChannels = buffer->Channels(); this->currentSampleRate = buffer->SampleRate(); + this->waveFormat= this->currentBits | this->currentChannels | this->currentMode | this->currentFunc; + + //this->waveHandle = esd_play_stream(this->waveFormat, (int)this->currentSampleRate, this->host, ) + int sock = esd_open_sound(NULL); + this->waveHandle = &sock; + //TODO: Do something here? // Close old waveout diff --git a/src/contrib/esdout/EsdOut.h b/src/contrib/esdout/EsdOut.h index 6c16d6c60..55e62fc75 100644 --- a/src/contrib/esdout/EsdOut.h +++ b/src/contrib/esdout/EsdOut.h @@ -90,8 +90,11 @@ class EsdOut : public IOutput{ int mode = ESD_STREAM, func = ESD_PLAY ;*/ // Current format + int currentBits; int currentChannels; long currentSampleRate; + int currentMode; + int currentFunc; double currentVolume; typedef std::list BufferList; diff --git a/src/contrib/flacdecoder/CMakeLists.txt b/src/contrib/flacdecoder/CMakeLists.txt index 773bd9d87..8051b6082 100644 --- a/src/contrib/flacdecoder/CMakeLists.txt +++ b/src/contrib/flacdecoder/CMakeLists.txt @@ -21,6 +21,6 @@ add_definitions( ) add_library( flacdecoder SHARED ${flacdecoder_SOURCES} ) -target_link_libraries( flacdecoder ${musikCube_LINK_LIBS}) +target_link_libraries( flacdecoder ${musikCube_LINK_LIBS} FLAC++) diff --git a/src/contrib/taglib_plugin/CMakeLists.txt b/src/contrib/taglib_plugin/CMakeLists.txt index beab3df85..3af0c48c2 100644 --- a/src/contrib/taglib_plugin/CMakeLists.txt +++ b/src/contrib/taglib_plugin/CMakeLists.txt @@ -20,6 +20,6 @@ add_definitions( ) add_library( taglib_plugin SHARED ${taglib_plugin_SOURCES} ) -target_link_libraries( taglib_plugin ${musikCube_LINK_LIBS}) +target_link_libraries( taglib_plugin ${musikCube_LINK_LIBS} tag) diff --git a/src/core/audio/Player.cpp b/src/core/audio/Player.cpp index b0693bff1..9e86de3bd 100644 --- a/src/core/audio/Player.cpp +++ b/src/core/audio/Player.cpp @@ -41,11 +41,11 @@ using namespace musik::core::audio; -PlayerPtr Player::Create(utfstring url,OutputPtr output){ +PlayerPtr Player::Create(utfstring &url,OutputPtr *output){ return PlayerPtr(new Player(url,output)); } -Player::Player(utfstring &url,OutputPtr output) +Player::Player(utfstring &url,OutputPtr *output) :volume(1.0) ,state(Player::Precache) ,url(url) @@ -54,8 +54,8 @@ Player::Player(utfstring &url,OutputPtr output) ,currentPosition(0) ,setPosition(-1) { - if(output){ - this->output = output; + if(*output){ + this->output = *output; }else{ // Start by finding out what output to use typedef std::vector OutputVector; @@ -145,7 +145,6 @@ int Player::State(){ void Player::ThreadLoop(){ #ifdef _DEBUG std::cerr << "Player::ThreadLoop started" << std::endl; - std::cerr << "this->url = " << this->url.c_str() << std::endl; #endif // First start the stream this->stream = Stream::Create(); diff --git a/src/core/audio/Player.h b/src/core/audio/Player.h index 62a02fa78..b878a041c 100644 --- a/src/core/audio/Player.h +++ b/src/core/audio/Player.h @@ -57,9 +57,9 @@ class Player : public IPlayer { public: typedef boost::shared_ptr OutputPtr; - static PlayerPtr Create(utfstring url,OutputPtr output=OutputPtr()); + static PlayerPtr Create(utfstring &url,OutputPtr *output=&OutputPtr()); private: - Player(utfstring &url,OutputPtr output); + Player(utfstring &url,OutputPtr *output); public: ~Player(void); diff --git a/src/core/audio/Stream.cpp b/src/core/audio/Stream.cpp index 7999d3db4..b62ae9110 100644 --- a/src/core/audio/Stream.cpp +++ b/src/core/audio/Stream.cpp @@ -48,6 +48,9 @@ Stream::Stream(unsigned int options) ,decoderSampleRate(0) ,decoderSamplePosition(0) { +#ifdef _DEBUG + std::cerr << "Stream::Stream()" << std::endl; +#endif // Get all DSPs // TODO: fixing PluginFactory if( (this->options&NoDSP)==0){ @@ -93,13 +96,18 @@ void Stream::SetPreferedBufferSampleSize(long samples){ } */ bool Stream::OpenStream(utfstring uri){ +#ifdef _DEBUG + std::cerr << "Stream::OpenStream()" << std::endl; +#endif // Open the filestream this->fileStream = musik::core::filestreams::Factory::OpenFile(uri.c_str()); if(!this->fileStream){ return false; } - +#ifdef _DEBUG + std::cerr << "File opened" << std::endl; +#endif // Look up what DecoderFactory to use StreamHelper::DecoderFactoryPtr decoderFactory; @@ -109,10 +117,18 @@ bool Stream::OpenStream(utfstring uri){ } } +#ifdef _DEBUG + std::cerr << "File decoder looked for" << std::endl; +#endif + if(!decoderFactory){ // We have failed to get a working decoderFactory return false; } +#ifdef _DEBUG + std::cerr << "Found file decoder" << std::endl; +#endif + // Create the decoder IDecoder *decoderPtr = decoderFactory->CreateDecoder(); @@ -120,13 +136,19 @@ bool Stream::OpenStream(utfstring uri){ return false; } +#ifdef _DEBUG + std::cerr << "Decoder opened" << std::endl; +#endif + // Open the decoder typedef musik::core::PluginFactory::DestroyDeleter IDecoderDeleter; this->decoder.reset(decoderPtr,IDecoderDeleter()); if( !this->decoder->Open(this->fileStream.get()) ){ return false; } - +#ifdef _DEBUG + std::cerr << "File opened by decoder" << std::endl; +#endif return true; } diff --git a/src/core/audio/Transport.cpp b/src/core/audio/Transport.cpp index 9b67b605a..28bdd97c5 100644 --- a/src/core/audio/Transport.cpp +++ b/src/core/audio/Transport.cpp @@ -56,7 +56,7 @@ Transport::~Transport(){ void Transport::PrepareNextTrack(utfstring trackUrl){ if(this->gapless && this->currentPlayer){ - this->nextPlayer = Player::Create(trackUrl,this->currentPlayer->output); + this->nextPlayer = Player::Create(trackUrl,&this->currentPlayer->output); this->nextPlayer->Play(); }else{ this->nextPlayer = Player::Create(trackUrl); @@ -82,7 +82,7 @@ void Transport::Start(utfstring url){ #ifdef _DEBUG std::cerr << "Transport: new output created for player" << std::endl; #endif - player = Player::Create(url, output); + player = Player::Create(url, &output); player->SetVolume(this->volume); #ifdef _DEBUG std::cerr << "Transport: new player created" << std::endl; diff --git a/src/core/filestreams/Factory.cpp b/src/core/filestreams/Factory.cpp index d61a2e6ee..568492b8d 100644 --- a/src/core/filestreams/Factory.cpp +++ b/src/core/filestreams/Factory.cpp @@ -62,6 +62,9 @@ Factory::Factory(){ FileStreamPtr Factory::OpenFile(const utfchar *uri){ +#ifdef _DEBUG + std::cerr << "Factory::OpenFile(" << uri << ")" << std::endl; +#endif typedef musik::core::PluginFactory::DestroyDeleter StreamDeleter; if(uri){ diff --git a/src/core/filestreams/LocalFileStream.cpp b/src/core/filestreams/LocalFileStream.cpp index 91f807e8a..b91a9e77e 100644 --- a/src/core/filestreams/LocalFileStream.cpp +++ b/src/core/filestreams/LocalFileStream.cpp @@ -76,7 +76,7 @@ bool LocalFileStream::Open(const utfchar *filename,unsigned int options){ boost::filesystem::utfpath file(filename); this->filesize = (long)boost::filesystem::file_size(file); this->extension = file.extension(); -// this->file = UTFFopen(filename,UTF("rb")); + this->file = UTFFopen(filename,UTF("rb")); this->fd = new boost::iostreams::file_descriptor(filename); this->fileStream = new boost::iostreams::stream(*this->fd); this->fileStream->exceptions ( std::ios_base::eofbit | std::ios_base::failbit | std::ios_base::badbit );