Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
music.cpp File Reference
#include "vegastrike.h"
#include "vs_globals.h"
#include "audiolib.h"
#include "universe.h"
#include "star_system.h"
#include "config_xml.h"
#include "lin_time.h"
#include "collection.h"
#include "unit_generic.h"
#include "vsfilesystem.h"
#include "music.h"
#include "base.h"
#include "networking/inet_file.h"
#include "networking/inet.h"
#include "python/python_compile.h"
#include "aldrv/al_globals.h"
#include <map>
#include <set>
#include <algorithm>

Go to the source code of this file.

Namespaces

 Muzak
 

Constant Groups

 Muzak
 

Macros

#define MAX_RECENT_HISTORY   "5"
 
#define checkerr(func)   do{print_check_err(((func)),#func);}while(0)
 

Functions

static void print_check_err (int errorcode, const char *str)
 
bool soundServerPipes ()
 
static int randInt (int max)
 
void * Muzak::readerThread (void *input)
 
std::vector< std::string > rsplit (std::string tmpstr, std::string splitter)
 
void incmusicvol (const KBData &, KBSTATE a)
 
void decmusicvol (const KBData &, KBSTATE a)
 

Variables

Musicmuzak = NULL
 
int muzak_count = 0
 
int muzak_cross_index = 0
 
std::map< std::string,
AUDSoundProperties > 
Muzak::cachedSongs
 

Macro Definition Documentation

#define checkerr (   func)    do{print_check_err(((func)),#func);}while(0)

Definition at line 57 of file music.cpp.

Referenced by Music::Listen(), Music::Music(), Muzak::readerThread(), and Music::~Music().

#define MAX_RECENT_HISTORY   "5"

Definition at line 38 of file music.cpp.

Function Documentation

void decmusicvol ( const KBData ,
KBSTATE  a 
)

Definition at line 857 of file music.cpp.

References Music::ChangeVolume(), and PRESS.

Referenced by initGlobalCommandMap().

858 {
859  if (a == PRESS) Music::ChangeVolume( -.0625 );
860 }
void incmusicvol ( const KBData ,
KBSTATE  a 
)

Definition at line 853 of file music.cpp.

References Music::ChangeVolume(), and PRESS.

Referenced by initGlobalCommandMap().

854 {
855  if (a == PRESS) Music::ChangeVolume( .0625 );
856 }
static void print_check_err ( int  errorcode,
const char *  str 
)
static

Definition at line 44 of file music.cpp.

References fprintf.

45 {
46 #ifndef _WIN32
47  if (errorcode) {
48  static char const unknown_error[16] = "Unknown error"; //added by chuck_starchaser to get rid of warning
49  char const *err = strerror( errorcode );
50  if (!err) err = unknown_error;
51  fprintf( stderr, "ERROR IN PTHREAD FUNCTION %s: %s (%d)\n", str, err, errorcode );
52  }
53 #endif
54 }
static int randInt ( int  max)
static

Definition at line 342 of file music.cpp.

References int.

343 {
344  int ans = int( ( ( (double) rand() )/( (double) RAND_MAX ) )*max );
345  if (ans == max)
346  return max-1;
347  return ans;
348 }
std::vector< std::string > rsplit ( std::string  tmpstr,
std::string  splitter 
)

Definition at line 630 of file music.cpp.

631 {
632  std::string::size_type where;
633  std::vector< std::string >ret;
634  while ( ( where = tmpstr.rfind( splitter ) ) != std::string::npos ) {
635  ret.push_back( tmpstr.substr( where+1 ) );
636  tmpstr = tmpstr.substr( 0, where );
637  }
638  if ( tmpstr.length() )
639  ret.push_back( tmpstr );
640  return ret;
641 }
bool soundServerPipes ( )

Definition at line 59 of file music.cpp.

References VegaConfig::getVariable(), XMLSupport::parse_bool(), and vs_config.

Referenced by Music::Listen(), Music::Music(), and Music::~Music().

60 {
61  static bool ret = XMLSupport::parse_bool( vs_config->getVariable( "audio", "pierce_firewall", "true" ) );
62  return ret;
63 }

Variable Documentation

int muzak_cross_index = 0