Package com.sun.mpk20.voicelib.app

Examples of com.sun.mpk20.voicelib.app.DefaultSpatializer


        }

        public void callStatusChanged(CallStatus status) {
            // find the player associated with this call
            VoiceManager vm = AppContext.getManager(VoiceManager.class);
      Player player = vm.getPlayer(callID);
      if (player == null) {
          logger.warning("[PlayerListener] No player for " + callID);
                return;
            }

            PresenceInfo pi = presenceMapRef.get().get(clientID);
            if (pi == null) {
                logger.warning("[PlayerListener] No presence info for " + clientID);
                return;
            }

            switch (status.getCode()) {
                case CallStatus.ESTABLISHED:
                    if (inRangeListener != null) {
                        player.addPlayerInRangeListener(inRangeListener);
                    }
                    break;

                case CallStatus.MUTED:
                    pi.setMuted(true);
View Full Code Here


  AudioGroup audioGroup;

  Call call = vm.getCall(callId);

  Player player = vm.getPlayer(callId);

  AudioGroup secretAudioGroup;

  WonderlandClientSender sender = WonderlandContext.getCommsManager().getSender(AudioManagerConnectionType.CONNECTION_TYPE);

  switch (code) {
  case CallStatus.ESTABLISHED:
      if (player == null) {
    logger.warning("Couldn't find player for " + status);
    return;
      }

      //vm.dump("all");
      player.setPrivateMixes(true);

      sender.send(new CallEstablishedMessage(callID));
      break;

  case CallStatus.MUTED:
      sender.send(new CallMutedMessage(callID, true));
      break;

  case CallStatus.UNMUTED:
      sender.send(new CallMutedMessage(callID, false));
      break;

        case CallStatus.STARTEDSPEAKING:
      if (player == null) {
    logger.warning("Couldn't find player for " + status);
    return;
      }

      secretAudioGroup = getSecretAudioGroup(player);

      if (playerIsChatting(player)) {
    VoiceChatHandler.getInstance().setSpeaking(player, callID, true, secretAudioGroup);
      }

      if (secretAudioGroup != null) {
    return;
      }

      sender.send(new CallSpeakingMessage(callID, true));
            break;

        case CallStatus.STOPPEDSPEAKING:
      if (player == null) {
    logger.warning("Couldn't find player for " + status);
    return;
      }

      secretAudioGroup = getSecretAudioGroup(player);

      if (playerIsChatting(player)) {
    VoiceChatHandler.getInstance().setSpeaking(player, callID, false, secretAudioGroup);
      }

      if (secretAudioGroup != null) {
    return;
      }

      sender.send(new CallSpeakingMessage(callID, false));
            break;

  case CallStatus.MIGRATED:
      if (isExternalCall) {
    return;
      }

      sender = WonderlandContext.getCommsManager().getSender(CellChannelConnectionType.CLIENT_TYPE);
      sender.send(clientID, new CallMigrateMessage(callID, true));
      break;

  case CallStatus.MIGRATE_FAILED:
      if (isExternalCall) {
    return;
      }

      sender.send(clientID, new CallMigrateMessage(callID, false));
      break;

  case CallStatus.ENDED:
      if (done) {
    return;
      }

if (false) {
      if (player != null) {
          AudioGroup[] audioGroups = player.getAudioGroups();

          for (int i = 0; i < audioGroups.length; i++) {
        audioGroups[i].removePlayer(player);
          }

    if (player.getSetup().isOutworlder) {
              vm.removePlayer(player);
    }
      } else {
    logger.warning("Couldn't find player for " + status);
      }
}

      done();
      sender.send(new CallEndedMessage(callID, status.getOption("Reason")));
            break;
   
  case CallStatus.BRIDGE_OFFLINE:
            logger.info("Bridge offline: " + status);
    // XXX need a way to tell the voice manager to reset all of the private mixes.
      Call c = vm.getCall(callId);

      if (callId == null || callId.length() == 0) {
                /*
                 * After the last BRIDGE_OFFLINE notification
                 * we have to tell the voice manager to restore
                 * all the pm's for live players.
                 */
                logger.fine("Restoring private mixes...");
      } else {
    if (c == null) {
        logger.warning("No call for " + callId);
        break;
    }

    Player p = c.getPlayer();

    if (p == null) {
        logger.warning("No player for " + callId);
        break;
    }

    try {
        c.end(true);
    } catch (IOException e) {
        logger.warning("Unable to end call " + callId);
    }

    try {
        AudioManagerConnectionHandler.setupCall(
       callId, c.getSetup(), -p.getX(), p.getY(), p.getZ(), p.getOrientation());
    } catch (IOException e) {
        logger.warning("Unable to setupCall " + c + " "
      + e.getMessage());
    }
      }
View Full Code Here

      }
      return;
  }

  if (dtmfKey.equals("#")) {
      Player p = vm.getPlayer(callID);

      if (p == null) {
    logger.warning("No Player for " + callID);
    return;
      }

      int n = p.getPlayersInRange().length;

      try {
                if (n == 0) {
                    call.playTreatment("tts:There is no one in range.");
                } else if (n == 1) {
View Full Code Here

  VoiceManager vm = AppContext.getManager(VoiceManager.class);

  Call call = null;

  Player player = null;

  if (simulateCalls == false) {
      call = vm.getCall(callID);

      if (call == null) {
          logger.warning("Can't find call for " + callID + " " + message);
          return;
      }

      player = vm.getPlayer(callID);
  }

  if (message instanceof OrbEndCallMessage) {
      if (call != null) {
          try {
              vm.endCall(call, true);
          } catch (IOException e) {
        logger.warning("Unable to end call " + call + ": "
            + e.getMessage());
          }
       } else {
    orbStatusListenerRef.get().endCall(callID);
      }

      sender.send(message);
      return;
  }

  if (message instanceof OrbMuteCallMessage) {
      if (call != null) {
          try {
              call.mute(((OrbMuteCallMessage)message).isMuted());
          } catch (IOException e) {
        logger.warning("Unable to mute call " + call + ": "
            + e.getMessage());
        return;
          }
      }

      sender.send(message);
      return;
  }

  if (message instanceof OrbChangeNameMessage) {
      username = ((OrbChangeNameMessage) message).getName();
      sender.send(message);
      return;
  }

  if (message instanceof OrbChangePositionMessage) {
      OrbChangePositionMessage msg = (OrbChangePositionMessage) message;

      if (player == null) {
    return;
      }

      Vector3f position = msg.getPosition();

      player.moved(position.getX(), position.getY(), position.getZ(),
    player.getOrientation());
      return;
  }

  if (message instanceof OrbSetVolumeMessage) {
      if (player == null) {
    logger.warning("no player for " + callID);
    return;
      }

      OrbSetVolumeMessage msg = (OrbSetVolumeMessage) message;

      String softphoneCallID = msg.getSoftphoneCallID();

      Player softphonePlayer = vm.getPlayer(softphoneCallID);

      if (softphonePlayer == null) {
    logger.warning("Can't find Player for softphone " + softphoneCallID);
    return;
      }

      DefaultSpatializer spatializer = (DefaultSpatializer)
    vm.getVoiceManagerParameters().livePlayerSpatializer.clone();

      double volume = msg.getVolume();

      spatializer.setAttenuator(volume);

      if (volume == 1) {
          softphonePlayer.removePrivateSpatializer(player);
      } else {
          softphonePlayer.setPrivateSpatializer(player, spatializer);
      }

      logger.fine("player " + player + " sp " + spatializer + " v " + volume);
      return;
   }
View Full Code Here

    setup.isOutworlder = true;
    setup.isLivePlayer = true;

    VoiceManager vm = AppContext.getManager(VoiceManager.class);

    Player externalPlayer = vm.createPlayer(call.getId(), setup);

    call.setPlayer(externalPlayer);
    externalPlayer.setCall(call);

    VoiceManagerParameters parameters = vm.getVoiceManagerParameters();

                AudioGroup defaultLivePlayerAudioGroup = parameters.livePlayerAudioGroup;
View Full Code Here

        VoiceManager vm = AppContext.getManager(VoiceManager.class);

  if (message instanceof GetPlayersInRangeRequestMessage) {
      GetPlayersInRangeRequestMessage msg = (GetPlayersInRangeRequestMessage) message;

      Player player = vm.getPlayer(msg.getPlayerID());

      if (player == null) {
    logger.warning("No player for " + msg.getPlayerID());
    return;

      }

      Player[] playersInRange = player.getPlayersInRange();

      String[] playerIDList = new String[playersInRange.length];

      for (int i = 0; i < playersInRange.length; i++) {
    playerIDList[i] = playersInRange[i].getId();   
      }
 
      sender.send(clientID, new GetPlayersInRangeResponseMessage(msg.getPlayerID(),
    playerIDList));

      return;
  }

        if (message instanceof UDPPortTestMessage) {
      UDPPortTestMessage msg = (UDPPortTestMessage) message;

      try {
          vm.testUDPPort(msg.getHost(), msg.getPort(), msg.getDuration());
      } catch (IOException e) {
    logger.warning("Unable to test udp port " + msg.getPort()
        + ": " + e.getMessage());
      }

      return;
  }

        if (message instanceof GetVoiceBridgeRequestMessage) {
            logger.fine("Got GetVoiceBridgeMessage");

      String callID = ((GetVoiceBridgeRequestMessage) message).getCallID();

      if (callID != null) {
    logger.info("Ending existing call " + callID);

    Call call = vm.getCall(callID);

    if (call != null) {
        try {
            call.end(false);
        } catch (IOException e) {
      logger.info("Unable to end call " + call
         + " " + e.getMessage());
        }
    } else {
        logger.info("Can't find call for " + callID);
    }
      }

            BridgeInfo bridgeInfo;

            try {
                bridgeInfo = vm.getVoiceBridge();

                logger.info("Sending voice bridge info '" + bridgeInfo + "'");
            } catch (IOException e) {
                logger.warning("unable to get voice bridge:  " + e.getMessage());
                return;
            }

            sender.send(clientID, new GetVoiceBridgeResponseMessage(bridgeInfo.toString()));
            return;
        }

        if (message instanceof PlaceCallRequestMessage) {
            logger.fine("Got PlaceCallMessage from " + clientID);

            placeCall(clientID, (PlaceCallRequestMessage) message);
            return;
        }

  if (message instanceof EndCallMessage) {
      EndCallMessage msg = (EndCallMessage) message;

            String callID = msg.getCallID();

            Call call = vm.getCall(callID);

            if (call == null) {
                logger.fine("Unable to end call " + callID);
                return;
            }

      try {
    vm.endCall(call, true);
            } catch (IOException e) {
                logger.warning(
                    "Unable to end call " + call + ":  " + e.getMessage());
            }

      sender.send(new CallEndedMessage(msg.getCallID(), msg.getReason()));
      return;
  }

        if (message instanceof MuteCallRequestMessage) {
            MuteCallRequestMessage msg = (MuteCallRequestMessage) message;

            String callID = msg.getCallID();

            Call call = vm.getCall(callID);

            if (call == null) {
                logger.info("Unable to mute/unmute call " + callID);
                return;
            }

            try {
                call.mute(msg.isMuted());
            } catch (IOException e) {
                logger.warning("Unable to mute/unmute call " + callID + ": " + e.getMessage());
                return;
            }

            return;
        }

        if (message instanceof TransferCallRequestMessage) {
            TransferCallRequestMessage msg = (TransferCallRequestMessage) message;

            String callID = msg.getPresenceInfo().getCallID();

            Call call = vm.getCall(callID);

            if (call == null) {
                if (msg.getCancel() == true) {
                    return;
                }

                double x = 0;
                double y = 0;
                double z = 0;
                double orientation = 0;

                Player player = vm.getPlayer(callID);

                if (player != null) {
                    x = -player.getX();
                    y = player.getY();
                    z = player.getZ();
                    orientation = player.getOrientation();
                }

                placeCall(clientID, new PlaceCallRequestMessage(msg.getPresenceInfo(),
        msg.getPhoneNumber(), x, y, z, orientation, true));
                return;
View Full Code Here

    public static void setupCall(String callID, CallSetup setup, double x,
            double y, double z, double direction) throws IOException {

        VoiceManager vm = AppContext.getManager(VoiceManager.class);

        Player p = vm.getPlayer(callID);

        Call call;

        call = vm.createCall(callID, setup);

        callID = call.getId();

        PlayerSetup ps = new PlayerSetup();

        if (p == null) {
            ps.x = x;
            ps.y = y;
            ps.z = z;
        } else {
            ps.x = p.getSetup().x;
            ps.y = p.getSetup().y;
            ps.z = p.getSetup().z;
        }

        ps.orientation = direction;
        ps.isLivePlayer = true;

        Player player = null;
        if(p==null) {
            player = vm.createPlayer(callID, ps);
        } else {
            player = p;
        }

        call.setPlayer(player);
        player.setCall(call);

        vm.getVoiceManagerParameters().livePlayerAudioGroup.addPlayer(player,
                new AudioGroupPlayerInfo(true, AudioGroupPlayerInfo.ChatType.PUBLIC));

        AudioGroupPlayerInfo info =
View Full Code Here

         * For each cell already in the cell, set a private spatializer
         * for this cell.
         */
        VoiceManager vm = AppContext.getManager(VoiceManager.class);

        Player player = vm.getPlayer(callId);

        logger.warning(callId + " entered cone " + name + " player " + player);

        if (player == null) {
            logger.warning("Can't find player for " + callId);
View Full Code Here

  logger.fine("Attenuate other groups to " + outsideAudioVolume + " name " + name);

  //System.out.println("Attenuate other groups to " + outsideAudioVolume + " name " + name);

  Player p = AppContext.getManager(VoiceManager.class).getPlayer(player.getId());

  if (player.toString().equals(p.toString()) == false) {
      System.out.println("WRONG player!");
      player = p;
  }

  player.attenuateOtherGroups(audioGroup, 0, outsideAudioVolume);
View Full Code Here

        if (audioGroup == null) {
            logger.warning("No audio group " + name);
            return;
        }

        Player player = vm.getPlayer(callId);

        if (player == null) {
            logger.warning("Can't find player for " + callId);
            return;
        }
View Full Code Here

TOP

Related Classes of com.sun.mpk20.voicelib.app.DefaultSpatializer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.