anyKode Marilou
|
Sound source device access.
class DeviceSoundSource : public Device;
ModaCpp.h
The DeviceSoundSource class cannot be created directly by user : it must be obtained by QueryDeviceSoundSource of the RobotPHX class. This device allows to control sound source volume and start/stop/pause it.
The various parameters given to the functions can be interpreted and modified if necessary by the device in order to respect the constraints imposed in modeling.
#include "Modacpp.h" #include "conio.h" #define MODASERVER "localhost" #define MYROBOTNAME "/" using namespace ModaCPP; int main(int argc, char* argv[]) { ModaCPP::Connection *connection=new ModaCPP::Connection(true); //Try connect to MODA server if(connection->Connect(MODASERVER)) { _cprintf("Connection ok to moda server\r\n"); //Find the robot (the PHX) ModaCPP::RobotPHX *robot=connection->QueryRobotPHX(MYROBOTNAME); if(robot) { _cprintf("robot found\r\n"); ModaCPP::DeviceSoundSource * pDeviceSoundSource0= robot->QueryDeviceSoundSource("zone0/s"); ModaCPP::DeviceSoundSource * pDeviceSoundSource1= robot->QueryDeviceSoundSource("zone1/s"); if(pDeviceSoundSource0 && pDeviceSoundSource1) { _cprintf("sound sources OK\r\n"); //start sound source 0, with a low volume pDeviceSoundSource0->Start(); pDeviceSoundSource0->SetVolume(1.0f); //start/pause/stop sound source 1 pDeviceSoundSource1->Start(); connection->Sleep(2000); pDeviceSoundSource1->Pause(); connection->Sleep(2000); pDeviceSoundSource1->Start(); connection->Sleep(2000); pDeviceSoundSource1->Stop(); } else { _cprintf("missing sound source(s)\r\n"); } } else { _cprintf("PHJX not found\r\n"); } } else { _cprintf("Unable to connect to moda server\r\n"); } //Disconnect & delete connection->Disconnect(); delete connection; return 0; }
Documentation v4.7 (18/01/2015), Copyright (c) 2015 anyKode. All rights reserved.
|
What do you think about this topic? Send feedback!
|