109 void AEVoice::doIni() {
110 startVar = par(
"startVar");
113 cXMLElement* slXml = NULL;
114 if (par(
"streamList").xmlValue() != NULL && par(
"streamList").xmlValue()->hasChildren()){
115 slXml = par(
"streamList").xmlValue();
117 error(
"streamList parameter not initialized!");
120 cXMLElementList streamsXML = slXml->getChildrenByTagName(
"Stream");
121 for (cXMLElementList::iterator it = streamsXML.begin(); it != streamsXML.end(); ++it) {
122 cXMLElement* m = *it;
124 std::string streamType =
"";
125 if (m->getAttribute(
"type")) {
126 streamType = m->getAttribute(
"type");
130 if(streamType ==
"GSM_06.10" || streamType ==
"1"){
133 }
else if(streamType ==
"G.729" || streamType ==
"2"){
136 }
else if(streamType ==
"G.723.1_A" || streamType ==
"3"){
139 }
else if(streamType ==
"G.723.1_B" || streamType ==
"4"){
142 }
else if(streamType ==
"ILBC_A" || streamType ==
"5"){
145 }
else if(streamType ==
"ILBC_B" || streamType ==
"6"){
150 cXMLElementList attrs = m->getChildren();
151 for (cXMLElementList::iterator jt = attrs.begin(); jt != attrs.end(); ++jt) {
152 cXMLElement* n = *jt;
153 if ( !strcmp(n->getTagName(),
"wt") ) {
154 double v = n->getNodeValue() ? atof(n->getNodeValue()) : 0;
155 if (v > 0) { st.
setWt(v); }
156 }
else if ( !strcmp(n->getTagName(),
"brt") ) {
157 double v = n->getNodeValue() ? atof(n->getNodeValue()) : 0;
158 if (v > 0) { st.
setBrt(v); }
159 }
else if ( !strcmp(n->getTagName(),
"avgS") ) {
160 double v = n->getNodeValue() ? atof(n->getNodeValue()) : 0;
162 }
else if ( !strcmp(n->getTagName(),
"avgW") ) {
163 double v = n->getNodeValue() ? atof(n->getNodeValue()) : 0;
165 }
else if ( !strcmp(n->getTagName(),
"varS") ) {
166 double v = n->getNodeValue() ? atof(n->getNodeValue()) : 0;
168 }
else if ( !strcmp(n->getTagName(),
"varW") ) {
169 double v = n->getNodeValue() ? atof(n->getNodeValue()) : 0;
171 }
else if ( !strcmp(n->getTagName(),
"rng") ) {
172 string nodeVal = n->getNodeValue();
173 if(nodeVal ==
"uniform"){
175 }
else if(nodeVal ==
"normal"){
182 streams.push_back(st);
186 void AEVoice::doFin(){
187 for(
sVecIt it = streams.begin(); it != streams.end(); it++){
188 EV << 1/it->getWt() <<
" -> " << it->getDataSize() << endl;
192 void AEVoice::iniCom(){
193 for(
sVecIt it = streams.begin(); it != streams.end(); it++){
195 scheduleAt(uniform(simTime(), simTime()+startVar),
new State_Change(it->getid(),
true) );
201 if(
State_Change * stc = dynamic_cast<State_Change*>(msg)){
203 Stream *s = &streams[stc->streamId];
206 scheduleAt(simTime(),
new Stream_Timer(stc->streamId) );
208 Stream *s = &streams[stc->streamId];
212 }
else if(
Stream_Timer * st = dynamic_cast<Stream_Timer*>(msg)){
213 Stream *s = &streams[st->streamId];
217 sendMsg(
new _PingMsg(), min(data, maxSize));
double minMaxNormal(double a, double b, int rng)
double(* RNG_function)(double, double, int rng)
void setRNG(RNG_function)