Forráskód Böngészése

sfxSndStream

Ogg file from libsndfile now working. we can pull more information from the format and specifics of the file from libsndfile should maybe look at updating all the parameters around mFormat so it feeds openal settings better.

Next step is to remove the other stream classes.
marauder2k7 1 éve
szülő
commit
147044796b

+ 4 - 4
Engine/source/sfx/media/sfxSndStream.cpp

@@ -128,6 +128,7 @@ void SFXSndStream::setPosition(U32 offset)
 sf_count_t SFXSndStream::sndSeek(sf_count_t offset, int whence, void* user_data)
 {
    VIO_DATA* vf = (VIO_DATA*)user_data;
+   Stream* stream = reinterpret_cast<Stream*>(vf->data);
 
    switch (whence)
    {
@@ -140,13 +141,13 @@ sf_count_t SFXSndStream::sndSeek(sf_count_t offset, int whence, void* user_data)
       break;
 
    case SEEK_END:
-      vf->offset = vf->length + offset;
+      vf->offset = vf->length - offset;
       break;
    default:
       break;
    };
 
-   return vf->offset;
+   return stream->setPosition(vf->offset) ? 0 : -1;
 }
 
 sf_count_t SFXSndStream::sndRead(void* ptr, sf_count_t count, void* user_data)
@@ -157,8 +158,7 @@ sf_count_t SFXSndStream::sndRead(void* ptr, sf_count_t count, void* user_data)
    if (vf->offset + count > vf->length)
       count = vf->length - vf->offset;
 
-   stream->read((U32)(count), reinterpret_cast<U8*>(ptr));
-
+   stream->read((U32)(count), ptr);
    vf->offset += count;
 
    return count;

+ 1 - 1
Engine/source/sfx/sfxProfile.cpp

@@ -350,7 +350,7 @@ SFXBuffer* SFXProfile::_createBuffer()
          Con::printf( "%s SFX: %s (%i channels, %i kHz, %.02f sec, %i kb)",
             mDescription->mIsStreaming ? "Streaming" : "Loading", resource->getFileName().c_str(),
             format.getChannels(),
-            format.getSamplesPerSecond() / 1000,
+            format.getSamplesPerSecond(),
             F32( resource->getDuration() ) / 1000.0f,
             format.getDataLength( resource->getDuration() ) / 1024 );
          #endif