Nsound  0.9.4
Functions | Variables
AudioBackendLibao.cc File Reference
#include <Nsound/Nsound.h>
#include <Nsound/AudioBackendLibao.h>
#include <Nsound/AudioPlayback.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <string.h>
#include <stdio.h>
#include <ao/ao.h>
Include dependency graph for AudioBackendLibao.cc:

Go to the source code of this file.

Functions

std::string print_info (ao_info *info)
 
static int32 integer (const std::string &x, Nsound::AudioBackend::State *state)
 
static std::string lower (const std::string &x)
 

Variables

const char * KSDATAFORMAT_SUBTYPE_PCM = "00000001-0000-0010-8000-00aa00389b71"
 
const uint32 N_DRIVER_TYPES = 13
 
std::string driver_types [N_DRIVER_TYPES]
 

Function Documentation

std::string print_info ( ao_info *  info)

Definition at line 110 of file AudioBackendLibao.cc.

Referenced by Nsound::AudioBackendLibao::getInfo().

111 {
112  std::stringstream ss;
113 
114  ss << "libao Driver Info:" << endl
115  << " type: " << info->type << endl
116  << " name: " << info->name << endl
117  << " short_name: " << info->short_name << endl
118  << " comment: " << info->comment << endl
119  << " preferred_byte_format: ";
120 
121  switch(info->preferred_byte_format)
122  {
123  case AO_FMT_LITTLE:
124  ss << "Little Endian" << endl;
125  break;
126 
127  case AO_FMT_BIG:
128  ss << "Big Endian" << endl;
129  break;
130 
131  case AO_FMT_NATIVE:
132 
133  if(ao_is_big_endian())
134  {
135  ss << "Native Big Endian" << endl;
136  }
137  else
138  {
139  ss << "Native Little Endian" << endl;
140  }
141  break;
142 
143  default:
144  ss << "Unknown!" << endl;
145  break;
146  }
147 
148  ss << " priority: " << info->priority << endl
149  << " option count: " << info->option_count << endl;
150 
151  for(int32 i = 0; i < info->option_count; ++i)
152  {
153  ss << " options[" << i << "]: " << info->options[i] << endl;
154  }
155 
156  return ss.str();
157 }
signed int int32
Definition: Nsound.h:142
static int32 integer ( const std::string &  x,
Nsound::AudioBackend::State state 
)
static

Definition at line 436 of file AudioBackendLibao.cc.

References Nsound::AudioBackend::BACKEND_ERROR, and M_THROW.

Referenced by Nsound::AudioBackendLibao::setOption().

437 {
438  std::stringstream ss(x);
439  int32 i = 0;
440 
441  ss >> i;
442 
443  if(ss.fail())
444  {
445  *state = AudioBackend::BACKEND_ERROR;
446  M_THROW("Nsound::AudioBackendLibao::setOption():"
447  << ": could not convert '"
448  << x
449  << "' to an integer.\n");
450  return -1;
451  }
452 
453  return i;
454 }
#define M_THROW(message)
Definition: Macros.h:108
signed int int32
Definition: Nsound.h:142
static std::string lower ( const std::string &  x)
static

Definition at line 458 of file AudioBackendLibao.cc.

Referenced by Nsound::AudioBackendLibao::setOption().

459 {
460  std::string y = x;
461  std::transform(y.begin(), y.end(), y.begin(), ::tolower);
462  return y;
463 }

Variable Documentation

const char* KSDATAFORMAT_SUBTYPE_PCM = "00000001-0000-0010-8000-00aa00389b71"

Definition at line 52 of file AudioBackendLibao.cc.

const uint32 N_DRIVER_TYPES = 13

Definition at line 55 of file AudioBackendLibao.cc.

Referenced by Nsound::AudioBackendLibao::scanDevices().

std::string driver_types[N_DRIVER_TYPES]
Initial value:
=
{
"alsa",
"arts",
"axis",
"esd",
"irix",
"macosx",
"nas",
"oss",
"pulse",
"roar",
"sndio",
"sun",
"wmm",
}

Definition at line 57 of file AudioBackendLibao.cc.

Referenced by Nsound::AudioBackendLibao::scanDevices().