Examples of AudioGroup


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

  Call softphoneCall = null;

  Player softphonePlayer = null;

  AudioGroup audioGroup = null;

  String audioGroupId = null;

  VoiceManagerParameters parameters = vm.getVoiceManagerParameters();

  if (softphoneCallID != null) {
      softphoneCall = vm.getCall(softphoneCallID);

      if (softphoneCall != null) {
          softphonePlayer = softphoneCall.getPlayer();
      }
       
      audioGroupId = softphoneCallID + "_" + externalCallID;

      audioGroup = vm.getAudioGroup(audioGroupId);
  }

  logger.fine("EXTERNAL CALLID IS " + externalCallID + " " + msg
      + " softphone callID " + softphoneCallID + " softphone call "
      + softphoneCall + " softphone player " + softphonePlayer);

  if (message instanceof PlayTreatmentMessage) {
      PlayTreatmentMessage m = (PlayTreatmentMessage) message;

      logger.fine("play treatment " + m.getTreatment()
    + " to " + listing.getExternalCallID() + " echo " + m.echo());

            if (listing.simulateCalls() == true) {
    return;
      }

      try {
    externalCall.playTreatment(m.getTreatment());
      } catch (IOException e) {
    logger.warning("Unable to play treatment to " + externalCall + ":  "
        + e.getMessage());
      }

      if (m.echo() == false) {
    return;
      }

      logger.fine("echoing treatment to " + softphoneCallID);

      try {
    softphoneCall.playTreatment(m.getTreatment());
      } catch (IOException e) {
    logger.warning("Unable to play treatment to " + softphoneCall + ":  "
        + e.getMessage());
    sender.send(clientID, new CallEndedResponseMessage(
                    phoneCellMO.getCellID(), listing, true, "Softphone is not connected!"));
                return;
      }

      return;
  }

  if (msg instanceof PlaceCallMessage) {
            //Our phone cell is asking us to begin a new call.

      if (listing.simulateCalls() == false) {
    relock(sender);
      }

      logger.fine("Got place call message " + externalCallID);

      PlayerSetup playerSetup = new PlayerSetup();
      //playerSetup.x =  translation.x;
      //playerSetup.y =  translation.y;
      //playerSetup.z =  translation.z;
      playerSetup.isOutworlder = true;
      playerSetup.isLivePlayer = true;

            if (listing.simulateCalls() == false) {
          PhoneStatusListener phoneStatusListener =
        new PhoneStatusListener(phoneCellMO, listing, clientID);

          if (softphoneCall == null || softphonePlayer == null) {
        logger.warning("Softphone player is not connected!");
                  sender.send(clientID, new CallEndedResponseMessage(
      phoneCellMO.getCellID(), listing, false,
      "Softphone is not connected!"));
        return;
          }

    CallSetup setup = new CallSetup();
 
    CallParticipant cp = new CallParticipant();

    setup.cp = cp;

    setup.externalOutgoingCall = true;

    try {
        setup.bridgeInfo = vm.getVoiceBridge();
     } catch (IOException e) {
        logger.warning("Unable to get voice bridge for call " + cp + ":  "
      + e.getMessage());
        return;
    }

    cp.setPhoneNumber(listing.getContactNumber());
    cp.setName(listing.getContactName());
    cp.setCallId(externalCallID);
    cp.setConferenceId(parameters.conferenceId);
    cp.setVoiceDetection(true);
    cp.setDtmfDetection(true);
    cp.setVoiceDetectionWhileMuted(true);
    cp.setHandleSessionProgress(true);

    try {
                    externalCall = vm.createCall(externalCallID, setup);
     } catch (IOException e) {
        logger.warning("Unable to create call " + cp + ":  "
      + e.getMessage());
        return;
    }

        externalPlayer = vm.createPlayer(externalCallID, playerSetup);

    externalCall.setPlayer(externalPlayer);

    externalPlayer.setCall(externalCall);

                if (listing.isPrivate()) {
        /*
         * Allow caller and callee to hear each other
         */
        AudioGroupSetup audioGroupSetup = new AudioGroupSetup();
        audioGroupSetup.spatializer = new FullVolumeSpatializer();

        audioGroup = vm.createAudioGroup(audioGroupId, audioGroupSetup);
        audioGroup.addPlayer(externalPlayer,
            new AudioGroupPlayerInfo(true,
            AudioGroupPlayerInfo.ChatType.EXCLUSIVE));
        audioGroup.addPlayer(softphonePlayer,
            new AudioGroupPlayerInfo(true,
            AudioGroupPlayerInfo.ChatType.EXCLUSIVE));
    } else {
        AudioGroup defaultLivePlayerAudioGroup =
            parameters.livePlayerAudioGroup;

        defaultLivePlayerAudioGroup.addPlayer(externalPlayer,
            new AudioGroupPlayerInfo(true,
            AudioGroupPlayerInfo.ChatType.PUBLIC));

        AudioGroup defaultStationaryPlayerAudioGroup =
            parameters.stationaryPlayerAudioGroup;

        defaultStationaryPlayerAudioGroup.addPlayer(externalPlayer,
            new AudioGroupPlayerInfo(false,
            AudioGroupPlayerInfo.ChatType.PUBLIC));
    }

    logger.fine("done with audio groups");
            }
           
      if (externalCall != null) {
          externalCallID = externalCall.getId();
      }

      logger.fine("Setting actual call id to " + externalCallID);

      listing.setExternalCallID(externalCallID)// set actual call Id

            //Check implicit privacy settings
            if (listing.isPrivate()) {
                /** HARRISNOTE: We need our client name later in order to
                 * setup private spatializers. But because we didn't know
                 * our proper client name in the PhoneCell, we update the
                 * callListing now that we do.
                 **/
    listing.setPrivateClientName(externalCallID);

                /*
     * Set the call audio to whisper mode until the caller
     * chooses to join the call.
     */
                if (listing.simulateCalls() == false) {
                    //Mute the two participants to the outside world
                    logger.fine("attenuate other groups");
        softphonePlayer.attenuateOtherGroups(audioGroup, 0, 0);
                    logger.fine("back from attenuate other groups");
                }
            } else {
    Vector3f center = new Vector3f();

    phoneCellMO.getWorldBounds().getCenter(center);

          center.setY((float).5);

                new Orb(listing.getContactName(), listing.getContactName(),
        externalCallID, center, .1, listing.simulateCalls());
      }

            if (listing.simulateCalls() == false) {
                //Place the calls audio at the phones position
             Vector3f location = new Vector3f();

                location = phoneCellMO.getWorldTransform(null).getTranslation(location);

                externalPlayer.moved(location.x, location.y, location.z, 0);
            }
         
            /*
       * Send PLACE_CALL_RESPONSE message back to all the clients
       * to signal success.
       */
            sender.send(clientID, new PlaceCallResponseMessage(
    phoneCellMO.getCellID(), listing, true));

      logger.fine("back from notifying user");
      return;
  }

  if (msg instanceof JoinCallMessage) {
            //Our phone cell wants us to join the call into the world.
           
            if (listing.simulateCalls() == false) {
                //Stop any current ringing.
          try {
                    softphoneCall.stopTreatment("ring_tone.au");
          } catch (IOException e) {
        logger.fine("Unable to stop treatment to " + softphoneCall + ":  "
            + e.getMessage());
          }

    AudioGroup defaultLivePlayerAudioGroup = parameters.livePlayerAudioGroup;

    defaultLivePlayerAudioGroup.addPlayer(externalPlayer,
        new AudioGroupPlayerInfo(true,
        AudioGroupPlayerInfo.ChatType.PUBLIC));

    AudioGroup defaultStationaryPlayerAudioGroup = parameters.stationaryPlayerAudioGroup;

    defaultStationaryPlayerAudioGroup.addPlayer(externalPlayer,
        new AudioGroupPlayerInfo(false,
        AudioGroupPlayerInfo.ChatType.PUBLIC));

          softphonePlayer.attenuateOtherGroups(audioGroup,
        AudioGroup.DEFAULT_SPEAKING_ATTENUATION,
View Full Code Here

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

  int code = status.getCode();

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

  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:
View Full Code Here

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

                if (listing.isPrivate()) {
        String audioGroupId = softphoneCallID + "_"
            + listing.getPrivateClientName();

        AudioGroup audioGroup = vm.getAudioGroup(audioGroupId);

        if (audioGroup != null) {
            if (softphoneCall.getPlayer() != null) {
                softphoneCall.getPlayer().attenuateOtherGroups(audioGroup,
              AudioGroup.DEFAULT_SPEAKING_ATTENUATION,
View Full Code Here

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

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

    VoiceManagerParameters parameters = vm.getVoiceManagerParameters();

                AudioGroup defaultLivePlayerAudioGroup = parameters.livePlayerAudioGroup;

                AudioGroupPlayerInfo groupInfo = new AudioGroupPlayerInfo(true,
                    AudioGroupPlayerInfo.ChatType.PUBLIC);

    groupInfo.defaultListenAttenuation = 1.0;

                defaultLivePlayerAudioGroup.addPlayer(externalPlayer, groupInfo);

    AudioGroup defaultStationaryPlayerAudioGroup = parameters.stationaryPlayerAudioGroup;

                defaultStationaryPlayerAudioGroup.addPlayer(externalPlayer,
                    new AudioGroupPlayerInfo(false,
                    AudioGroupPlayerInfo.ChatType.PUBLIC));

                call.mute(false);
View Full Code Here

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

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

        AudioGroup audioGroup = vm.getAudioGroup(name);

        if (audioGroup == null) {
      AudioGroupSetup setup = new AudioGroupSetup();

      setup.audioGroupListener = this;

      setup.spatializer = new FullVolumeSpatializer();

            setup.spatializer.setAttenuator(Spatializer.DEFAULT_MAXIMUM_VOLUME);

      //System.out.println("Creating audio group for " + name);

      audioGroup = vm.createAudioGroup(name, setup);
        }

  //System.out.println("CONE PROX Player:  " + player);

  boolean isSpeaking = (inPrivateChat(audioGroup, player) == false);

        audioGroup.addPlayer(player, new AudioGroupPlayerInfo(isSpeaking,
                AudioGroupPlayerInfo.ChatType.PRIVATE));
       
  WonderlandClientSender sender =
            WonderlandContext.getCommsManager().getSender(AudioManagerConnectionType.CONNECTION_TYPE);
View Full Code Here

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

    private void cellExited(String callId) {
        logger.warning(callId + " exited cone " + name + " avatar cell ID " + callId);

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

        AudioGroup audioGroup = vm.getAudioGroup(name);

        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;
        }

        audioGroup.removePlayer(player);

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

  sender.send(new ConeOfSilenceEnterExitMessage(name, callId, false));
View Full Code Here

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

    }

    public void remove() {
        VoiceManager vm = AppContext.getManager(VoiceManager.class);

        AudioGroup audioGroup = vm.getAudioGroup(name);

  logger.warning("Remove " + audioGroup + " name " + name);

  if (audioGroup == null) {
      return;
View Full Code Here

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

  if (group == null) {
      logger.warning("Invalid audio group 'null'");
      return;
  }

  AudioGroup audioGroup = vm.getAudioGroup(group);

  if (message instanceof VoiceChatLeaveMessage) {
      if (audioGroup == null) {
    logger.info("audioGroup is null");
    return;
      }

      VoiceChatLeaveMessage msg = (VoiceChatLeaveMessage) message;

      Player player = vm.getPlayer(msg.getCallee().getCallID());

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

          if (audioGroup.getNumberOfPlayers() == 0) {
        endVoiceChat(vm, audioGroup)// cleanup
          }
    return;
      }
     
      setCOSSpeaking(player, msg.getCOSName(), true);

      AudioGroupPlayerInfo info = audioGroup.getPlayerInfo(player);

      if (info == null) {
    return;   // not in group
      }

      /*
       * XXX If the player to be removed from the group is
       * in range of another player which is in a public chat,
       * then rather than removing the player, re-add it
       * as a transient member.
       */
      if (isInRangeOfPublicChat(audioGroup, player)) {
        addPlayerToAudioGroup(audioGroup, player, msg.getCallee(),
        ChatType.PUBLIC, true);

    return;
      }

      removePlayerFromAudioGroup(audioGroup, player);

      if (audioGroup.getNumberOfPlayers() <= 1) {
    endVoiceChat(vm, audioGroup);
      }

      CallSetup callSetup = player.getCall().getSetup();

      if (callSetup.incomingCall || callSetup.externalOutgoingCall) {
          addPlayerToAudioGroup(
        vm.getVoiceManagerParameters().livePlayerAudioGroup,
        player, msg.getCallee(), ChatType.PUBLIC);

          addPlayerToAudioGroup(
        vm.getVoiceManagerParameters().stationaryPlayerAudioGroup,
        player, msg.getCallee(), ChatType.PUBLIC);
      }
     
      return;
  }

  if (message instanceof VoiceChatEndMessage) {
      if (audioGroup == null) {
    logger.info("audioGroup is null");
    return;
      }

      endVoiceChat(vm, audioGroup);
      return;
  }

  if (message instanceof VoiceChatJoinAcceptedMessage) {
      if (audioGroup == null) {
    logger.warning("Join accepted:  Audio group " + group + " no longer exists");
    return;
      }

      VoiceChatJoinAcceptedMessage msg = (VoiceChatJoinAcceptedMessage) message;

      Player player = vm.getPlayer(msg.getCallee().getCallID());

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

      addPlayerToAudioGroup(audioGroup, player, msg.getCallee(), msg.getChatType());

      sender.send(msg);
      return;
  }

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

      if (audioGroup == null) {
    logger.warning("Hold:  Audio group " + group + " no longer exists");
    return;
      }
 
      Player player = vm.getPlayer(msg.getCallee().getCallID());

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

      setCOSSpeaking(player, msg.getCOSName(), msg.isOnHold());

      AudioGroupPlayerInfo playerInfo = audioGroup.getPlayerInfo(player);

      if (playerInfo == null) {
    logger.warning("No player info for " + player);
    return;
      }
 
      if (msg.isOnHold()) {
    playerInfo.isSpeaking = false;
    playerInfo.listenAttenuation = msg.getVolume();
      } else {
    playerInfo.isSpeaking = true;
    playerInfo.speakingAttenuation = AudioGroup.DEFAULT_SPEAKING_ATTENUATION;
    playerInfo.listenAttenuation = AudioGroup.DEFAULT_LISTEN_ATTENUATION;
      }

      updateAttenuation(player);
      sender.send(clientID, msg);
      return;
  }

  if (message instanceof VoiceChatDialOutMessage) {
      VoiceChatPhoneMessageHandler.getInstance().dialOut(
    sender, clientID, (VoiceChatDialOutMessage) message);
      return;
  }

  if (message instanceof VoiceChatJoinMessage == false) {
      logger.warning("Invalid message type " + message);
      return;
  }

  VoiceChatJoinMessage msg = (VoiceChatJoinMessage) message;

  if (audioGroup == null) {
      AudioGroupSetup setup = new AudioGroupSetup();
      setup.spatializer = new FullVolumeSpatializer();
      setup.spatializer.setAttenuator(Spatializer.DEFAULT_MAXIMUM_VOLUME);
      setup.virtualPlayerListener = this;
      setup.audioGroupListener = this;
      audioGroup = vm.createAudioGroup(group, setup);
  }

  PresenceInfo[] calleeList = msg.getCalleeList();

  PresenceInfo caller = msg.getCaller();

  if (msg.getChatType() != null) {
      Player player = vm.getPlayer(caller.getCallID());

      if (player == null) {
    logger.warning("No Player for " + caller.getCallID());
    return;
      }

      boolean added = addPlayerToAudioGroup(audioGroup, player, caller, msg.getChatType());

      if (added) {
          sender.send(new VoiceChatJoinAcceptedMessage(group, caller, msg.getChatType()));
      }

      if (added == false && (calleeList == null || calleeList.length == 0)) {
          endVoiceChat(vm, audioGroup);
          return;
      }
  }

  logger.info("Request to join AudioGroup " + group + " caller " + caller);

  if (calleeList == null || calleeList.length == 0) {
      return;
  }

  for (int i = 0; i < calleeList.length; i++) {
      PresenceInfo info = calleeList[i];

      String callID = info.getCallID();

      Player player = vm.getPlayer(callID);

      if (player == null) {
    logger.warning("No player for callID " + callID);
    continue;
      }

      if (info.getClientID() == null) {
    /*
     * This is an outworlder.  We automatically join them to the group
      * The InCallDialog can be used to change the privacy setting
     * and to remove the outworlder from the chat.
     */
          addPlayerToAudioGroup(audioGroup, player, info, msg.getChatType());
          sender.send(new VoiceChatJoinAcceptedMessage(group, info, msg.getChatType()));
        continue;
      }

      AudioGroupPlayerInfo playerInfo = audioGroup.getPlayerInfo(player);

      if (playerInfo != null && sameChatType(playerInfo.chatType, msg.getChatType())) {
    logger.fine("Player " + info
        + " is already in audio group " + audioGroup);

View Full Code Here

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

  if (COSName == null) {
      return;
  }

  AudioGroup COSAudioGroup = AppContext.getManager(VoiceManager.class).getAudioGroup(COSName);

  if (COSAudioGroup == null) {
      logger.warning("No COS audio group for " + COSName);
      return;
  }

  COSAudioGroup.setSpeaking(player, isSpeaking);
    }
View Full Code Here

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

    }

    public static void updateAttenuation(Player player) {
  VoiceManager vm = AppContext.getManager(VoiceManager.class);

  AudioGroup livePlayerAudioGroup = vm.getVoiceManagerParameters().livePlayerAudioGroup;

  AudioGroup stationaryPlayerAudioGroup = vm.getVoiceManagerParameters().stationaryPlayerAudioGroup;

  AudioGroup[] audioGroups = player.getAudioGroups();

  AudioGroup nonPublicAudioGroup = null;

  AudioGroupPlayerInfo playerInfo;

  for (int i = 0; i < audioGroups.length; i++) {
      AudioGroup audioGroup = audioGroups[i];

      playerInfo = audioGroup.getPlayerInfo(player);

      if (playerInfo != null && playerInfo.isSpeaking &&
        playerInfo.chatType.equals(AudioGroupPlayerInfo.ChatType.PUBLIC) == false) {

    nonPublicAudioGroup = audioGroup;
    break;
      }
  }

  playerInfo = livePlayerAudioGroup.getPlayerInfo(player);

  if (playerInfo != null) {
      if (nonPublicAudioGroup != null && playerInfo.isTransientMember == false) {
          livePlayerAudioGroup.setSpeaking(player, false);
          livePlayerAudioGroup.setListenAttenuation(player, AudioGroup.MINIMAL_LISTEN_ATTENUATION);
      } else {
                livePlayerAudioGroup.setSpeaking(player, true);
                livePlayerAudioGroup.setSpeakingAttenuation(player, AudioGroup.DEFAULT_SPEAKING_ATTENUATION);
                livePlayerAudioGroup.setListenAttenuation(player, AudioGroup.DEFAULT_LISTEN_ATTENUATION);
      }
  }

  if (stationaryPlayerAudioGroup.getPlayerInfo(player) != null) {
      if (nonPublicAudioGroup != null) {
          stationaryPlayerAudioGroup.setListenAttenuation(player, AudioGroup.MINIMAL_LISTEN_ATTENUATION);
      } else {
                stationaryPlayerAudioGroup.setListenAttenuation(player, AudioGroup.DEFAULT_LISTEN_ATTENUATION);
      }
  }

  /*
   * If we're in a nonPublicAudioGroup, we also have to attenuate the other groups we're listening to.
   */
  double attenuation;

  if (nonPublicAudioGroup != null) {
      attenuation = AudioGroup.MINIMAL_LISTEN_ATTENUATION;
  } else {
      attenuation = AudioGroup.DEFAULT_LISTEN_ATTENUATION;
  }

  for (int i = 0; i < audioGroups.length; i++) {
      AudioGroup audioGroup = audioGroups[i];

      if (audioGroup.equals(livePlayerAudioGroup) || audioGroup.equals(stationaryPlayerAudioGroup)) {
    continue;
      }

      playerInfo = audioGroup.getPlayerInfo(player);

      if (playerInfo.chatType.equals(ChatType.PUBLIC) && playerInfo.listenAttenuation != 0) {
    audioGroup.setListenAttenuation(player, attenuation);
      }
  }

  player.setPrivateMixes(true);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.