0
0

Hi hi.

So, first off, i dont know nothing about how music works. Im just following the file format instructions – so if im doing something really crazy, you know why… 😉

What im trying to play is an old 8bit unsigned PCM stream from an old game we are trying to port. I started out using the basslib. Created a stream with the 8BIT mode set, and registered a callback, then started playing the stream and it sounded flawlessly right away.

However, i pretty soon realized that the basslib aint cross-platform, so, i changed for fmod. Created a stream:
[code:2z11i3ox]
const dword dwMode = FMOD_LOOP_OFF | FMOD_CREATESTREAM | FMOD_OPENUSER;

            FMOD_CREATESOUNDEXINFO csei = {0};

            csei.cbsize  = sizeof(FMOD_CREATESOUNDEXINFO);
            csei.length  = vTracks[nTrackIndex].dwSize;
            csei.numchannels = 1;
            csei.defaultfrequency = Tracks[nTrackIndex].dwSamplerate * 4;
            csei.format = FMOD_SOUND_FORMAT_PCM8;
            csei.pcmreadcallback = reinterpret_cast<FMOD_SOUND_PCMREADCALLBACK>(readStream);
            csei.userdata = reinterpret_cast<void *>(&vTracks[nTrackIndex]);
            csei.suggestedsoundtype = FMOD_SOUND_TYPE_USER;

            FMOD::Sound *pSound;
            if(pFmod->createSound(0, dwMode, &csei, &pSound) != FMOD_OK)
            {
                std::cout << "createSound..." << std::endl;
                return false;
            }

            FMOD::Channel *pChannel;
            if(pFmod->playSound(FMOD_CHANNEL_FREE, pSound, false, &pChannel) != FMOD_OK)
            {
                std::cout << "playSound..." << std::endl;
                return false;
            }

            return true;

[/code:2z11i3ox]

And used the same callback i did with basslib. I can hear the music, and its correct, but there are HEAPS of noice, sound really crappy. At first i figured it was lunix’s fault, so i swapped for win, but it sounds equally crappy there…

Can anyone see any obvious mistakes?

Thanks
// iddqd42

  • You must to post comments
0
0

if it is 8 bit, then the data should be unsigned, so xor your data with 128

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.