Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7284 in orxonox.OLD


Ignore:
Timestamp:
Apr 13, 2006, 8:52:41 PM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: sound plays again… hmm… this was a very stupid bug in MultiType… hope it is fixed now, but who knows…

Location:
trunk/src/lib
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/sound/sound_engine.cc

    r7256 r7284  
    9999{
    100100  MultiType channels = Preferences::getInstance()->getString(CONFIG_SECTION_AUDIO, CONFIG_NAME_AUDIO_CHANNELS, "32");
     101  printf("==== THIS IS A TEST ");
     102  channels.debug();
    101103  this->maxSourceCount = channels.getInt();
    102104
     
    138140void SoundEngine::popALSource(ALuint& source)
    139141{
    140   if (source != 0)
    141     return;
    142   else
    143   {
    144 
    145     /// @TODO try to create more sources if needed
    146     if (!this->ALSources.empty())
    147     {
    148       source = this->ALSources.top();
    149       this->ALSources.pop();
    150     }
    151   }
     142  assert (source == 0);
     143
     144  /// @TODO try to create more sources if needed
     145  if (!this->ALSources.empty())
     146  {
     147    source = this->ALSources.top();
     148    this->ALSources.pop();
     149  }
     150
    152151}
    153152
     
    272271bool SoundEngine::initAudio()
    273272{
    274 //   ALenum result;
    275 //   PRINTF(3)("Initialisazing openAL sound engine\n");
    276 //   const char* defaultDevice =(const char*) alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER);
    277 //   const char* deviceList = (const char*)alcGetString(NULL,ALC_DEVICE_SPECIFIER);
    278 //   const char* devWalk = deviceList;
    279 //   //  if (alcIsExtensionPresent(NULL, (const ALCchar*)"ALC_ENUMERATION_EXT") == AL_TRUE)
    280 //   { // try out enumeration extension
    281 //     PRINTF(3)("Enumeration-extension found\n");
    282 //
    283 //     PRINTF(3)("Default device: %s\n", defaultDevice);
    284 //     do
    285 //     {
    286 //       PRINTF(3)("%s\n", devWalk);
    287 //       devWalk += strlen(devWalk)+1;
    288 //     }
    289 //     while (devWalk[0] != '\0');
    290 //  }
     273  //   ALenum result;
     274  //   PRINTF(3)("Initialisazing openAL sound engine\n");
     275  //   const char* defaultDevice =(const char*) alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER);
     276  //   const char* deviceList = (const char*)alcGetString(NULL,ALC_DEVICE_SPECIFIER);
     277  //   const char* devWalk = deviceList;
     278  //   //  if (alcIsExtensionPresent(NULL, (const ALCchar*)"ALC_ENUMERATION_EXT") == AL_TRUE)
     279  //   { // try out enumeration extension
     280  //     PRINTF(3)("Enumeration-extension found\n");
     281  //
     282  //     PRINTF(3)("Default device: %s\n", defaultDevice);
     283  //     do
     284  //     {
     285  //       PRINTF(3)("%s\n", devWalk);
     286  //       devWalk += strlen(devWalk)+1;
     287  //     }
     288  //     while (devWalk[0] != '\0');
     289  //  }
    291290
    292291  // INITIALIZING THE DEVICE:
    293 //   char deviceName[] =
    294 //   #ifdef __WIN32__
    295 //     "Direct3D";
    296 //   #else
    297 //     "'( ( devices '( native null ) ) )";
    298 //   #endif
     292  //   char deviceName[] =
     293  //   #ifdef __WIN32__
     294  //     "Direct3D";
     295  //   #else
     296  //     "'( ( devices '( native null ) ) )";
     297  //   #endif
    299298
    300299  this->device = alcOpenDevice(NULL);
     
    312311  // #endif
    313312
     313  printf ("===== SOURCECOUNT: %d\n", this->maxSourceCount);
    314314  this->setDopplerValues(SOUND_DOPPLER_FACTOR, SOUND_DOPPLER_VELOCITY);
    315315  this->allocateSources(this->maxSourceCount);
     
    409409{
    410410  switch(err)
    411     {
     411  {
    412412    case ALC_NO_ERROR:
    413413      return ("AL_NO_ERROR");
     
    422422    case ALC_OUT_OF_MEMORY:
    423423      return("ALC_OUT_OF_MEMORY");
    424     };
    425 }
    426 
     424  };
     425}
     426
  • trunk/src/lib/sound/sound_source.cc

    r6142 r7284  
    6868  if (unlikely(this->sourceID == 0))
    6969    SoundEngine::getInstance()->popALSource(this->sourceID);
     70  assert (this->sourceID != 0);
    7071
    7172  alSourceStop(this->sourceID);
     
    7677    alSourcei (this->sourceID, AL_BUFFER, this->buffer->getID());
    7778  this->bPlay = true;
     79  printf("%d\n", this->sourceID);
     80
    7881}
    7982
  • trunk/src/lib/util/multi_type.cc

    r7221 r7284  
    296296  else if (this->type & MT_STRING)
    297297  {
    298     if (this->storedString == "") return 0;
    299     char* endPtr = NULL;
    300     int result = strtol(this->storedString.c_str(), &endPtr, 10);
    301     if ( endPtr >= this->storedString.c_str() && endPtr < this->storedString.c_str() + strlen(this->storedString.c_str()))
    302       return 0;
    303     else
    304       return result;
     298    std::stringstream ssStream(this->storedString);
     299    int iReturn;
     300    ssStream >> iReturn;
     301    return iReturn;
    305302  }
    306303  return 0;
     
    323320    char* endPtr = NULL;
    324321    double result = strtod(this->storedString.c_str(), &endPtr);
    325     if ( endPtr >= this->storedString.c_str() && endPtr < this->storedString.c_str() + strlen(this->storedString.c_str()))
     322    if ( endPtr >= this->storedString.c_str() && endPtr < this->storedString.c_str() + this->storedString.size())
    326323      return 0.0f;
    327324    else
Note: See TracChangeset for help on using the changeset viewer.