0
0

Hi,
I am trying to play an ogg file under Windows XP without streaming it. Normally it works without any problems, but if I play bigger files (>7.5 MB), the playSound() function returns FMOD_ERR_MEMORY. According to the task manager I have a memory usage of about 100 MB when the error occurs, so I don’t see why this does not work. I would appreciate any help on this problem.

Short example program (search for "FMOD_ERR_MEMORY here" to see where the error occurs):
[code:3gd69kxj]

include <windows.h>

include <stdio.h>

include <conio.h>

include "fmod/inc/fmod.hpp"

include "fmod/inc/fmod_errors.h"

void ERRCHECK(FMOD_RESULT result)
{
if (result != FMOD_OK)
{
printf("FMOD error! (%d) %s\n", result, FMOD_ErrorString(result));
exit(-1);
}
}

int main(int argc, char *argv[])
{
FMOD::System *system;
FMOD::Sound *sound1;
FMOD::Channel *channel = 0;
FMOD_RESULT result;
int key=0;
unsigned int version;

/*
    Create a System object and initialize.
*/

//This does not help:
//result = result = FMOD::Memory_Initialize(malloc(536870912), 536870912, 0, 0, 0);
//ERRCHECK(result);

result = FMOD::System_Create(&amp;system);
ERRCHECK(result);

result = system-&gt;getVersion(&amp;version);
ERRCHECK(result);

if (version &lt; FMOD_VERSION)
{
    printf(&quot;Error!  You are using an old version of FMOD %08x.  This program requires %08x\n&quot;, version, FMOD_VERSION);
    return 0;
}

result = system-&gt;init(32, FMOD_INIT_NORMAL, 0);
ERRCHECK(result);

result = system-&gt;createSound(&quot;test.ogg&quot;, FMOD_HARDWARE, 0, &amp;sound1);
ERRCHECK(result);

result = system-&gt;playSound(FMOD_CHANNEL_FREE, sound1, false, &amp;channel);
//FMOD_ERR_MEMORY here:
ERRCHECK(result);
/*
    Main loop.
*/
do
{
    if (kbhit())
    {
        key = getch();
        system-&gt;update();
    }
    Sleep(10);
} while (key != 27);

printf(&quot;\n&quot;);

/*
    Shut down
*/
result = sound1-&gt;release();
ERRCHECK(result);
result = system-&gt;close();
ERRCHECK(result);
result = system-&gt;release();
ERRCHECK(result);

return 0;

}
[/code:3gd69kxj]

Output of the logging DLL:
[code:3gd69kxj]
FMOD: SystemI::init : FMOD Ex Version: 00041601
FMOD: SystemI::init : maxchannels = 32, flags = 00000000, extradriverdata = 00000000
FMOD: SystemI::close :
FMOD: SystemI::close : Remove all user channel groups.
FMOD: SystemI::close : Remove miscllaneous DSP stuff.
FMOD: SystemI::close : done.

FMOD: OutputDSound::init : Register DLL
FMOD: OutputDSound::registerDLL : Detected DIRECTX 9
FMOD: OutputDSound::init : Enumerate Drivers
FMOD: FMOD_Output_DSound_EnumProc : Enumerating "Realtek AC97 Audio"
FMOD: OutputDSound::init : CoInitialize
FMOD: OutputDSound::init : DirectSoundCreate8 : mSelectedDriver = 0
FMOD: OutputDSound::init : SetCooperativeLevel
FMOD: OutputDSound::init : GetCaps
FMOD: OutputDSound::init : Create Primary Buffer
FMOD: OutputDSound::init : Set Primary Buffer Format
FMOD: OutputDSound::init : Getting Listener Interface
FMOD: OutputDSound::initEAX4 : Querying EAX4
FMOD: OutputDSound::createSample : length 1024, channels 1, format 2, mode 00020010
FMOD: OutputDSound::createSample : done
FMOD: OutputDSound::querySupportEAX4 : check properties 00000001
FMOD: OutputDSound::initEAX4 : failed (2).
FMOD: SoundI::release : (null) (009004B0)
FMOD: SoundI::release : free this. (009004B0)
FMOD: SoundI::release : done (009004B0)
FMOD: OutputDSound::initEAX4 : Querying EAX3
FMOD: OutputDSound::createSample : length 1024, channels 1, format 2, mode 00020010
FMOD: OutputDSound::createSample : done
FMOD: OutputDSound::querySupportEAX3 : check properties 00000000
FMOD: OutputDSound::initEAX3 : failed EAX check, releasing reverb interface
FMOD: SoundI::release : (null) (009004B0)
FMOD: SoundI::release : free this. (009004B0)
FMOD: SoundI::release : done (009004B0)
FMOD: OutputDSound::initEAX2 : Querying EAX2
FMOD: OutputDSound::createSample : length 1024, channels 1, format 2, mode 00020010
FMOD: OutputDSound::createSample : done
FMOD: OutputDSound::querySupportEAX2 : check properties 00000000
FMOD: OutputDSound::querySupportEAX2 : success.
FMOD: OutputDSound::querySupportEAX2 : check properties 00000001
FMOD: OutputDSound::querySupportEAX2 : success.
FMOD: OutputDSound::querySupportEAX2 : check properties 0000000B
FMOD: OutputDSound::querySupportEAX2 : success.
FMOD: OutputDSound::querySupportEAX2 : check properties 0000000C
FMOD: OutputDSound::querySupportEAX2 : success.
FMOD: OutputDSound::querySupportEAX2 : check properties 0000000D
FMOD: OutputDSound::querySupportEAX2 : success.
FMOD: OutputDSound::querySupportEAX2 : check properties 00000002
FMOD: OutputDSound::querySupportEAX2 : success.
FMOD: OutputDSound::querySupportEAX2 : check properties 00000003
FMOD: OutputDSound::querySupportEAX2 : success.
FMOD: OutputDSound::querySupportEAX2 : check properties 00000005
FMOD: OutputDSound::querySupportEAX2 : success.
FMOD: OutputDSound::querySupportEAX2 : check properties 00000006
FMOD: OutputDSound::querySupportEAX2 : success.
FMOD: OutputDSound::querySupportEAX2 : check properties 00000007
FMOD: OutputDSound::querySupportEAX2 : success.
FMOD: OutputDSound::querySupportEAX2 : check properties 00000008
FMOD: OutputDSound::querySupportEAX2 : success.
FMOD: OutputDSound::querySupportEAX2 : check properties 00000009
FMOD: OutputDSound::querySupportEAX2 : success.
FMOD: OutputDSound::querySupportEAX2 : check properties 0000000A
FMOD: OutputDSound::querySupportEAX2 : success.
FMOD: OutputDSound::querySupportEAX2 : check properties 0000000E
FMOD: OutputDSound::querySupportEAX2 : success.
FMOD: OutputDSound::querySupportEAX2 : check properties 00000004
FMOD: OutputDSound::querySupportEAX2 : success.
FMOD: OutputDSound::querySupportEAX2 : check properties 0000000F
FMOD: OutputDSound::querySupportEAX2 : success.
FMOD: OutputDSound::initEAX2 : setting reverb environment to OFF
FMOD: OutputDSound::initEAX2 : found!
FMOD: OutputDSound::init : Done
FMOD: SystemI::init : Set up software engine
FMOD: OutputDSound::createSample : length 24576, channels 2, format 2, mode 0002002a
FMOD: OutputDSound::createSample : done
FMOD: Thread::initThread : Initializing FMOD mixer thread. priority 3
FMOD: Thread::initThread : – Stacksize 32768. Stack pointer 00000000 : usesemaphore = 0 : sleeptime = 10
FMOD: Thread::callback : * FMOD mixer thread started
FMOD: Thread::initThread : done.
FMOD: SystemI::init : Set up emulated output
FMOD: SystemI::init : create the channel pool
FMOD: SystemI::init : Set up streamer
FMOD: Thread::initThread : Initializing FMOD stream thread. priority 2
FMOD: Thread::initThread : – Stacksize 49152. Stack pointer 00000000 : usesemaphore = 0 : sleeptime = 10
FMOD: Thread::callback : * FMOD stream thread started
FMOD: Thread::initThread : done.
FMOD: OutputDSound::setPropertiesEAX2 : Entering
FMOD: OutputDSound::setPropertiesEAX2 : setting listener properties
FMOD: OutputDSound::setPropertiesEAX2 : Entering
FMOD: OutputDSound::setPropertiesEAX2 : setting listener properties
FMOD: OutputDSound::setPropertiesEAX2 : Entering
FMOD: OutputDSound::setPropertiesEAX2 : setting listener properties
FMOD: OutputDSound::setPropertiesEAX2 : Entering
FMOD: OutputDSound::setPropertiesEAX2 : setting listener properties
FMOD: OutputDSound::setPropertiesEAX2 : Entering
FMOD: OutputDSound::setPropertiesEAX2 : setting listener properties
FMOD: SystemI::init : done

FMOD: SystemI::createSoundInternal : filename = test.ogg : mode 00000020
FMOD: SystemI::createSoundInternal : 19 codecs found. Scan all until one succeeds
FMOD: CodecTag::openInternal : attempting to open ID3 or ASF tags..
FMOD: Codec::release :
FMOD: Plugin::release : (0094B2F8)
FMOD: Plugin::release : done
FMOD: Codec::release :
FMOD: CodecCDDA::openInternal : attempting to open as CDDA..
FMOD: Codec::release :
FMOD: Plugin::release : (0094B3F8)
FMOD: Plugin::release : done
FMOD: Codec::release :
FMOD: CodecFSB::openInternal : attempting to open as FSB..
FMOD: CodecFSB::openInternal : Header check failed. Not an FSB
FMOD: Codec::release :
FMOD: CodecFSB::closeInternal :
FMOD: CodecFSB::closeInternal : done
FMOD: Plugin::release : (0094B500)
FMOD: Plugin::release : done
FMOD: Codec::release :
FMOD: CodecVAG::openInternal : attempting to open as VAG..
FMOD: CodecVAG::openInternal : ‘VAG’ ID check failed [Ogg]
FMOD: Codec::release :
FMOD: Plugin::release : (0094B668)
FMOD: Plugin::release : done
FMOD: Codec::release :
FMOD: CodecWav::openInternal : attempting to open as WAV..
FMOD: Codec::release :
FMOD: Plugin::release : (0094B500)
FMOD: Plugin::release : done
FMOD: Codec::release :
FMOD: CodecOggVorbis::openInternal : attempting to open as OGG..
FMOD: SystemI::createSoundInternal : Format has 0 subsounds.
FMOD: SystemI::createSoundInternal : Create as FMOD_CREATESAMPLE
FMOD: SystemI::createSoundInternal : creating subsound 0/0
FMOD: SystemI::createSample : mode 00000020 length 21351168 samples, lengthbytes 7272454
FMOD: SystemI::createSample : subsamples = 1, channels = 2
FMOD: SystemI::createSample : subsample 0. output = 0033F588
FMOD: SystemI::createSample : use hw
FMOD: OutputDSound::createSample : length 21351168, channels 2, format 2, mode 00000029
FMOD: OutputDSound::createSample : done
FMOD: SystemI::createSample : done
FMOD: SystemI::createSoundInternal : No name found in file, use filename.
FMOD: SystemI::createSoundInternal : done. OpenState now = FMOD_OPENSTATE_READY. 151109 bytes used
[/code:3gd69kxj]

  • You must to post comments
0
0

directsound has a problem with big samples, it just can’t handle them (or the soundcard can’t).

The simple fix for this is not use hardware, use FMOD_SOFTWARE flag to load your sound.

  • You must to post comments
0
0

I really thought I tried that before, but apparently I haven’t since it works fine now. Thanks for the help!

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.