Browse files

Now using odp port from hosted object to send sounds.

  • Loading branch information...
1 parent f8c6fa8 commit e76eca7fe5bd69503b031dcb8b28d9f7de6f5288 @bmistree committed Apr 9, 2012
View
2 liboh/plugins/sdlaudio/PluginInterface.cpp
@@ -20,7 +20,7 @@ Simulation* createSDLAudio(
const String& options,
Network::IOStrandPtr ptr
) {
- return new SDL::AudioSimulation(ctx,ptr,presenceid);
+ return new SDL::AudioSimulation(ctx,ptr,presenceid,obj);
}
}
View
10 liboh/plugins/sdlaudio/SDLAudio.cpp
@@ -35,17 +35,19 @@ extern void mixaudio(void* _sim, Uint8* raw_stream, int raw_len) {
}
AudioSimulation::AudioSimulation(
- Context* ctx,Network::IOStrandPtr ptr,const SpaceObjectReference& sporef)
+ Context* ctx,Network::IOStrandPtr ptr,const SpaceObjectReference& sporef,
+ HostedObjectPtr hop)
: audioStrand(ptr),
mContext(ctx),
mInitializedAudio(false),
mOpenedAudio(false),
mSporef(sporef),
mClipHandleSource(0),
mPlaying(false),
- mURLFullSoundLoaderManager(NULL)
+ mURLFullSoundLoaderManager(NULL),
+ mSoundSender(NULL),
+ mHostedObjectPtr(hop)
{
-
}
@@ -116,7 +118,7 @@ void AudioSimulation::iStart(Liveness::Token lt)
std::tr1::bind(&AudioSimulation::downloadFinished,this,
_1, _2, _3,livenessToken())));
- mSoundSender = new SoundSender(mSporef);
+ mSoundSender = new SoundSender(mSporef,mHostedObjectPtr);
//lkjs;
}
View
5 liboh/plugins/sdlaudio/SDLAudio.hpp
@@ -10,6 +10,8 @@
#include <sirikata/core/transfer/TransferMediator.hpp>
#include <sirikata/core/transfer/ResourceDownloadTask.hpp>
#include <sirikata/core/util/Liveness.hpp>
+#include <sirikata/oh/Platform.hpp>
+
#include "SoundCommon.hpp"
#include "URLFullSoundLoader.hpp"
@@ -29,7 +31,7 @@ class AudioSimulation : public Simulation,
public:
AudioSimulation(
Context* ctx, Network::IOStrandPtr aStrand,
- const SpaceObjectReference& sporef);
+ const SpaceObjectReference& sporef,HostedObjectPtr hop);
virtual ~AudioSimulation();
@@ -103,6 +105,7 @@ class AudioSimulation : public Simulation,
URLFullSoundLoaderManager* mURLFullSoundLoaderManager;
SoundSender* mSoundSender;
+ HostedObjectPtr mHostedObjectPtr;
/**
If get a request to download full audio, and then play it, downloads file
View
2 liboh/plugins/sdlaudio/SoundCommon.hpp
@@ -20,6 +20,8 @@
//we create a separate port for the listener
#define AUDIO_LISTENER_PORT 26
+#include <sirikata/oh/HostedObject.hpp>
+
namespace Sirikata
{
View
36 liboh/plugins/sdlaudio/SoundSender.cpp
@@ -7,17 +7,14 @@ namespace Sirikata
namespace SDL
{
-SoundSender::SoundSender(SpaceObjectReference _sporef)
+SoundSender::SoundSender(SpaceObjectReference _sporef,HostedObjectPtr hop)
: sporef(_sporef),
mDelegateODPService(NULL),
makerSubmitPort(NULL),
+ mHostedObjectPtr(hop),
dest (SpaceObjectReference::null(),AUDIO_MAKER_PORT)
{
- mDelegateODPService = new ODP::DelegateService(
- std::tr1::bind(
- &SoundSender::createDelegateODPPort, this,
- _1, _2, _3
- ));
+ createMakerSubmitPort();
}
@@ -26,7 +23,7 @@ void SoundSender::createMakerSubmitPort()
{
//listen for any sound maker messages from any object
makerSubmitPort =
- mDelegateODPService->bindODPPort(sporef,AUDIO_MAKER_PORT);
+ mHostedObjectPtr->bindODPPort(sporef,AUDIO_MAKER_PORT);
if (makerSubmitPort != NULL)
{
@@ -48,24 +45,16 @@ bool SoundSender::startSend(ClipHandle id ,Transfer::DenseDataPtr data)
if (makerSubmitPort == NULL)
return false;
-
String msgBody ("test");
MemoryReference toSend(msgBody);
//send to space
makerSubmitPort->send(dest, toSend);
-
+
//lkjs;
AUDIO_LOG(error,"Fix. start send of soundsender should actually do something");
return true;
}
-bool SoundSender::sendODP(
- const ODP::Endpoint& dest_ep, MemoryReference payload, ODP::PortID port)
-{
- //lkjs;
- AUDIO_LOG(error,"Fix. Must add send functionality to soundsender");
- return true;
-}
@@ -80,21 +69,6 @@ void SoundSender::handleMsgAcks (
-ODP::DelegatePort* SoundSender::createDelegateODPPort(
- ODP::DelegateService* parentService, const SpaceObjectReference& spaceobj,
- ODP::PortID port)
-{
- ODP::Endpoint port_ep(spaceobj,port);
-
- return new ODP::DelegatePort(
- mDelegateODPService,
- port_ep,
- std::tr1::bind(
- &SoundSender::sendODP, this,
- _1, _2, port));
-}
-
-
} //namespace sdl
View
14 liboh/plugins/sdlaudio/SoundSender.hpp
@@ -6,6 +6,7 @@
#include <sirikata/core/transfer/ResourceDownloadTask.hpp>
#include <sirikata/core/util/Liveness.hpp>
#include <sirikata/core/odp/DelegateService.hpp>
+#include <sirikata/oh/Platform.hpp>
#include "SoundCommon.hpp"
@@ -15,22 +16,17 @@ namespace Sirikata
namespace SDL
{
+
class SoundSender : public Liveness
{
public:
- SoundSender(SpaceObjectReference _sporef);
+ SoundSender(SpaceObjectReference _sporef,HostedObjectPtr hop);
~SoundSender();
bool startSend(ClipHandle,Transfer::DenseDataPtr);
private:
- ODP::DelegatePort* createDelegateODPPort(
- ODP::DelegateService* parentService, const SpaceObjectReference& spaceobj,
- ODP::PortID port);
-
- bool sendODP(
- const ODP::Endpoint& dest_ep, MemoryReference payload, ODP::PortID port);
void createMakerSubmitPort();
@@ -45,9 +41,11 @@ class SoundSender : public Liveness
//any message received on this port
ODP::Port* makerSubmitPort;
-
+ HostedObjectPtr mHostedObjectPtr;
+
ODP::Endpoint dest;
+
};
} //end namespace sdl
View
10 space/src/Forwarder.hpp
@@ -62,8 +62,8 @@ namespace Sirikata
namespace Trace {
class Trace;
}
- class ObjectConnection;
- class OSegLookupQueue;
+class ObjectConnection;
+class OSegLookupQueue;
class ForwarderServiceQueue;
class ODPFlowScheduler;
class LocationService;
@@ -74,9 +74,9 @@ class DelegateService;
}
class Forwarder : public ServerMessageDispatcher,
- public ServerMessageRouter,
- public MessageRecipient,
- public ServerMessageQueue::Sender,
+ public ServerMessageRouter,
+ public MessageRecipient,
+ public ServerMessageQueue::Sender,
public ServerMessageReceiver::Listener,
private ForwarderServiceQueue::Listener,
public Service

0 comments on commit e76eca7

Please sign in to comment.