« Return to Thread: alcSuspendContext is not working

alcSuspendContext is not working

by jikowhitewolf :: Rate this Message:

Reply to Author | View in Thread

Hi,

I am trying to halt and resume the sounds from OpenALSystem. But i discovered that alcSuspendContext does not work for me according to the tutorial.
http://www.devmaster.net/articles/openal-tutorials/lesson4.php

Belows are my 2 functions, hope anyone has any idea why it is not working. Is there something else that I missed out?



        void HaltAudioSystem()
        {
                cout << "HaltAudioSystem" << endl;

                ALCcontext* pCurContext;
                ALCdevice* pCurDevice;

                // Get the current context.
                pCurContext = alcGetCurrentContext();

                // Get the device used by that context.
                pCurDevice = alcGetContextsDevice(pCurContext);

                // set the current context to NULL will 'shutdown' openAL
                alcMakeContextCurrent(NULL);

                // now suspend your context to 'pause' your sound world
                alcSuspendContext(pCurContext);

        }


        void ResumeAudioSystem()
        {
                cout << "ResumeAudioSystem " << endl;
                // Get Current Context
                ALCcontext* alcContext = alcGetCurrentContext();
                // Restore open al context
                alcMakeContextCurrent(alcContext);
                // 'unpause' my context
                alcProcessContext(alcContext);
        }

Thanks in advance

 « Return to Thread: alcSuspendContext is not working