Advertisement
Hattiwatti

mumble_plugin.h

May 29th, 2014
400
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.97 KB | None | 0 0
  1. /* Copyright (C) 2005-2012, Thorvald Natvig <[email protected]>
  2.  
  3.    All rights reserved.
  4.  
  5.    Redistribution and use in source and binary forms, with or without
  6.    modification, are permitted provided that the following conditions
  7.    are met:
  8.  
  9.    - Redistributions of source code must retain the above copyright notice,
  10.      this list of conditions and the following disclaimer.
  11.    - Redistributions in binary form must reproduce the above copyright notice,
  12.      this list of conditions and the following disclaimer in the documentation
  13.      and/or other materials provided with the distribution.
  14.    - Neither the name of the Mumble Developers nor the names of its
  15.      contributors may be used to endorse or promote products derived from this
  16.      software without specific prior written permission.
  17.  
  18.    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  19.    ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  20.    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  21.    A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
  22.    CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  23.    EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  24.    PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  25.    PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  26.    LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  27.    NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  28.    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  29. */
  30.  
  31. #ifndef MUMBLE_MUMBLE_PLUGIN_H_
  32. #define MUMBLE_MUMBLE_PLUGIN_H_
  33.  
  34. #include <string>
  35. #include <map>
  36.  
  37. #define MUMBLE_PLUGIN_MAGIC 0xd63ab7c0
  38. #define MUMBLE_PLUGIN_MAGIC_2 0xd63ab7cf
  39. #define MUMBLE_PLUGIN_VERSION 2
  40.  
  41. typedef struct _MumblePlugin {
  42.     unsigned int magic;
  43.     const std::wstring &description;
  44.     const std::wstring &shortname;
  45.     void (__cdecl *about)(HWND);
  46.     void (__cdecl *config)(HWND);
  47.     int (__cdecl *trylock)();
  48.     void (__cdecl *unlock)();
  49.     const std::wstring(__cdecl *longdesc)();
  50.     int (__cdecl *fetch)(float *avatar_pos, float *avatar_front, float *avatar_top, float *camera_pos, float *camera_front, float *camera_top, std::string &context, std::wstring &identity);
  51. } MumblePlugin;
  52.  
  53. typedef struct _MumblePlugin2 {
  54.     unsigned int magic;
  55.     unsigned int version;
  56.     int (__cdecl *trylock)(const std::multimap<std::wstring, unsigned long long int> &);
  57. } MumblePlugin2;
  58.  
  59. typedef MumblePlugin *(__cdecl *mumblePluginFunc)();
  60. typedef MumblePlugin2 *(__cdecl *mumblePlugin2Func)();
  61.  
  62. /*
  63.  * All plugins must implement one function called mumbleGetPlugin(), which
  64.  * follows the mumblePluginFunc type and returns a MumblePlugin struct.
  65.  *
  66.  * magic should be initialized to MUMBLE_PLUGIN_MAGIC. description is the
  67.  * name of the plugin shown in the GUI, while shortname is used for TTS.
  68.  *
  69.  * The individual functions are:
  70.  * about(HWND parent) - Player clicked the about button over plugin
  71.  * config(HWND parent) - Player clicked the config button
  72.  * trylock() - Search system for likely process and try to lock on.
  73.  *      The parameter is a set of process names and associated PIDs.
  74.  *      Return 1 if succeeded, else 0. Note that once a plugin is locked on,
  75.  *      no other plugins will be queried.
  76.  * unlock() - Unlock from process. Either from user intervention or
  77.  *      because fetch failed.
  78.  * fetch(...) - Fetch data from locked process. avatar_pos is position in
  79.  *      world coordinates (1 meter per unit). avatar_front and avatar_top
  80.  *      specify the heading of the player, as in where he is looking.
  81.  *      You need at minimum to figure out pos and front, otherwise
  82.  *      sounds cannot be placed. If you do not fetch top, make it the
  83.  *      same as front but rotated 90 degrees "upwards".
  84.  *
  85.  *      camera_x is the same, but for the camera. Make this identical to the
  86.  *      avatar position if you don't know (or if it's a 1st person
  87.  *      perspective).
  88.  *
  89.  *      It is important that you set all fields to 0.0 if you can't
  90.  *      fetch meaningfull values, like between rounds and such.
  91.  *
  92.  *      context and identity are transmitted to the server. Only players
  93.  *      with identical context will hear positional audio from each other.
  94.  *      Mumble will automatically prepend the shortname of the plugin to
  95.  *      the context, so make this a representation of the game server and
  96.  *      team the player is on.
  97.  *
  98.  *      identity is retained by the server and is pollable over Ice/DBus,
  99.  *      to be used by external scripts. This should uniquiely identify the
  100.  *      player inside the game.
  101.  *
  102.  *      ctx_len and id_len are initialized to the bufferspace available. Set these
  103.  *      to -1 to keep the previous value (as parsing and optimizing can be CPU
  104.  *      intensive)
  105.  *
  106.  *      The function should return 1 if it is still "locked on",
  107.  *      otherwise it should return 0. Mumble will call unlock()
  108.  *      if it return 0, and go back to polling with trylock()
  109.  *      once in a while.
  110.  */
  111.  
  112. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement