Пример #1
0
// toggles pause/unpause
void Sound::togglePause(void)
{
  FMOD_BOOL p;

  FMOD_Channel_GetPaused(channel, &p);
  FMOD_Channel_SetPaused(channel, !p);
}
Пример #2
0
void sound_toggle_pause(void)
{
    if (loaded) {
        FMOD_BOOL p;
        FMOD_Channel_GetPaused(_channel,&p);
        FMOD_Channel_SetPaused (_channel,!p);
    }
}
Пример #3
0
void Audio::pauseMusique() {
	if(!_canalMusique)
		return;
	
	FMOD_BOOL pause;
	FMOD_Channel_GetPaused(_canalMusique, &pause);
	
	FMOD_Channel_SetPaused(_canalMusique, !pause);
}
Пример #4
0
	/// is the sound currently paused
	virtual const bool IsPaused(){
		FMOD_BOOL b;
		if(mpChannel == 0)return false;
		else {
			FMOD_Channel_GetPaused(mpChannel,&b);
			if(b)return true;
			else return false;
		}
	}
void SoundEngine::togglePauseChannel(unsigned int channel)
{
    FMOD_BOOL etat;
    FMOD_CHANNEL *canal=getChannel(channel);
    FMOD_Channel_GetPaused(canal, &etat);

    if (etat == 1) // Si la chanson est en pause
        FMOD_Channel_SetPaused(canal, 0); // On enlève la pause
    else // Sinon, elle est en cours de lecture
        FMOD_Channel_SetPaused(canal, 1); // On met en pause
}
Пример #6
0
void Java_org_fmod_realtimestitching_Example_cPause(JNIEnv *env, jobject thiz)
{
	FMOD_RESULT result = FMOD_OK;
	FMOD_BOOL paused = 0;

	result = FMOD_Channel_GetPaused(gChannel, &paused);
	CHECK_RESULT(result);

	result = FMOD_Channel_SetPaused(gChannel, !paused);
	CHECK_RESULT(result);
}
Пример #7
0
void pause_fiend_music(void)
{
	FMOD_BOOL paused;
	if(!sound_is_on)return;
	if(strcmp(current_music,"none")==0)return;
	
	FMOD_Channel_GetPaused(fmod_music_channel, &paused);
	if(!paused)
	{
		FMOD_Channel_SetPaused(fmod_music_channel, TRUE);
	}
}
Пример #8
0
void        FMODSound::play(void)
{
  if (this->_channel)
    {
      FMOD_Channel_GetPaused(this->_channel, &(this->_tmp));
    }
  if (this->_tmp == true)
    FMOD_Channel_SetPaused(this->_channel, false);
  else
    FMOD_System_PlaySound(this->_system, FMOD_CHANNEL_FREE,
			  this->_sound, 0, &(this->_channel));
  FMOD_Channel_SetVolume(this->_channel, this->_volume);
}
Пример #9
0
bool CSound::IsPaused(void) const {
	// Check if we have a sound loaded
	if (!mLoaded) {
		return false;
	}
#if __ENABLE_CFMOD
	// Check if we have a valid channel
	FMOD_BOOL bPaused = 0;
	if (0 != mpChannel) {
		FMOD_Channel_GetPaused(mpChannel, &bPaused);
	}

	return (bPaused != 0);
#else
	return true;
#endif
}
Пример #10
0
bool Sound::IsPaused() const
{
	// Check if we have a sound loaded
	if (!mLoaded)
	{
		return false;
	}

	// Check if we have a valid channel
	FMOD_BOOL bPaused = 0;
	if (0 != mpChannel)
	{
		FMOD_Channel_GetPaused(mpChannel, &bPaused);
	}

	return (bPaused != 0);
}
Пример #11
0
void Audio::jouerMusique() throw(Audio::Exc_Son) {
	if(_canalMusique) {
		FMOD_BOOL pause;
		FMOD_Channel_GetPaused(_canalMusique, &pause);
		if(!pause)
			return;
	}
	
	resultat = FMOD_System_PlaySound(_systeme, FMOD_CHANNEL_FREE, _musique, false, &_canalMusique);
	erreur(resultat, 8);
	
	int nb;
	FMOD_Channel_GetIndex(_canalMusique, &nb);
	_canaux[nb] = _canalMusique;
		
	FMOD_Channel_SetVolume(_canalMusique, Parametres::volumeMusique());
}
Пример #12
0
int main(int argc, char *argv[])
{
    FMOD_SYSTEM            *system;
    FMOD_SOUND             *sound;
    FMOD_CHANNEL           *channel = 0;
    FMOD_RESULT             result;
    FMOD_MODE               mode = FMOD_2D | FMOD_OPENUSER | FMOD_LOOP_NORMAL | FMOD_HARDWARE;
    int                     key;
    int                     channels = 2;
    FMOD_CREATESOUNDEXINFO  createsoundexinfo;
    unsigned int            version;

    /*
        Create a System object and initialize.
    */
    result = FMOD_System_Create(&system);
    ERRCHECK(result);

    result = FMOD_System_GetVersion(system, &version);
    ERRCHECK(result);

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

    result = FMOD_System_Init(system, 32, FMOD_INIT_NORMAL, NULL);
    ERRCHECK(result);
        
    printf("============================================================================\n");
    printf("User Created Sound Example.  Copyright (c) Firelight Technologies 2004-2011.\n");
    printf("============================================================================\n");
    printf("Sound played here is generated in realtime.  It will either play as a stream\n");
    printf("which means it is continually filled as it is playing, or it will play as a \n");
    printf("static sample, which means it is filled once as the sound is created, then  \n");
    printf("when played it will just play that short loop of data.                      \n");
    printf("============================================================================\n");
    printf("\n");

    do
    {
        printf("Press 1 to play as a runtime decoded stream. (will carry on infinitely)\n");
        printf("Press 2 to play as a static in memory sample. (loops a short block of data)\n");
        printf("Press Esc to quit.\n\n");
        key = getch();

    } while (key != 27 && key != '1' && key != '2');

    if (key == 27)
    {
        return 0;
    }
    else if (key == '1')
    {
        mode |= FMOD_CREATESTREAM;
    }

    memset(&createsoundexinfo, 0, sizeof(FMOD_CREATESOUNDEXINFO));
    createsoundexinfo.cbsize            = sizeof(FMOD_CREATESOUNDEXINFO);              /* required. */
    createsoundexinfo.decodebuffersize  = 44100;                                       /* Chunk size of stream update in samples.  This will be the amount of data passed to the user callback. */
    createsoundexinfo.length            = 44100 * channels * sizeof(signed short) * 5; /* Length of PCM data in bytes of whole song (for Sound::getLength) */
    createsoundexinfo.numchannels       = channels;                                    /* Number of channels in the sound. */
    createsoundexinfo.defaultfrequency  = 44100;                                       /* Default playback rate of sound. */
    createsoundexinfo.format            = FMOD_SOUND_FORMAT_PCM16;                     /* Data format of sound. */
    createsoundexinfo.pcmreadcallback   = pcmreadcallback;                             /* User callback for reading. */
    createsoundexinfo.pcmsetposcallback = pcmsetposcallback;                           /* User callback for seeking. */

    result = FMOD_System_CreateSound(system, 0, mode, &createsoundexinfo, &sound);
    ERRCHECK(result);

    printf("Press space to pause, Esc to quit\n");
    printf("\n");

    /*
        Play the sound.
    */

    result = FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, sound, 0, &channel);
    ERRCHECK(result);

    /*
        Main loop.
    */
    do
    {
        if (kbhit())
        {
            key = getch();

            switch (key)
            {
                case ' ' :
                {
                    int paused;
                    FMOD_Channel_GetPaused(channel, &paused);
                    FMOD_Channel_SetPaused(channel, !paused);
                    break;
                }
            }
        }

        FMOD_System_Update(system);

        if (channel)
        {
            unsigned int ms;
            unsigned int lenms;
            int          playing;
            int          paused;

            FMOD_Channel_IsPlaying(channel, &playing);
            if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE) && (result != FMOD_ERR_CHANNEL_STOLEN))
            {
                ERRCHECK(result);
            }

            result = FMOD_Channel_GetPaused(channel, &paused);
            if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE) && (result != FMOD_ERR_CHANNEL_STOLEN))
            {
                ERRCHECK(result);
            }

            result = FMOD_Channel_GetPosition(channel, &ms, FMOD_TIMEUNIT_MS);
            if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE) && (result != FMOD_ERR_CHANNEL_STOLEN))
            {
                ERRCHECK(result);
            }

            result = FMOD_Sound_GetLength(sound, &lenms, FMOD_TIMEUNIT_MS);
            if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE) && (result != FMOD_ERR_CHANNEL_STOLEN))
            {
                ERRCHECK(result);
            }

            printf("Time %02d:%02d:%02d/%02d:%02d:%02d : %s\r", ms / 1000 / 60, ms / 1000 % 60, ms / 10 % 100, lenms / 1000 / 60, lenms / 1000 % 60, lenms / 10 % 100, paused ? "Paused " : playing ? "Playing" : "Stopped");
            fflush(stdout);
        }

        Sleep(10);

    } while (key != 27);

    printf("\n");

    /*
        Shut down
    */
    result = FMOD_Sound_Release(sound);
    ERRCHECK(result);
    result = FMOD_System_Close(system);
    ERRCHECK(result);
    result = FMOD_System_Release(system);
    ERRCHECK(result);

    return 0;
}
Пример #13
0
int main(int argc, char *argv[])
{
    FMOD_SYSTEM             *system;
    FMOD_SOUND              *sound;
    FMOD_CHANNEL            *channel = 0;
    FMOD_RESULT             result;
    int                     key;
    FMOD_CREATESOUNDEXINFO  createsoundexinfo;
    unsigned int            version, decodesound_lengthbytes = 0;
    int                     decodesound_channels;
    float                   decodesound_rate;

    /*
        Create a System object and initialize.
    */
    result = FMOD_System_Create(&system);
    ERRCHECK(result);

    result = FMOD_System_GetVersion(system, &version);
    ERRCHECK(result);

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

    result = FMOD_System_Init(system, 32, FMOD_INIT_NORMAL, 0);
    ERRCHECK(result);

    InitializeCriticalSection(&decodecrit);

    /*
        First create the 'decoder sound'.  Note it is a stream that does not initially read any data, because FMOD_OPENONLY has been specified.
        We could use createSound instead of createStream but that would allocate memory for the whole sound which is a waste.
    */
    result = FMOD_System_CreateStream(system, "../media/wave.mp3", FMOD_OPENONLY | FMOD_LOOP_NORMAL | FMOD_LOWMEM | FMOD_CREATESTREAM, 0, &decodesound); 
    ERRCHECK(result);

    result = FMOD_Sound_GetLength(decodesound, &decodesound_lengthbytes, FMOD_TIMEUNIT_PCMBYTES);
    ERRCHECK(result);

    result = FMOD_Sound_GetFormat(decodesound, 0, 0, &decodesound_channels, 0);
    ERRCHECK(result);

    result = FMOD_Sound_GetDefaults(decodesound, &decodesound_rate, 0, 0, 0);
    ERRCHECK(result);
        
    /*
        Now create a user created PCM stream that we will feed data into, and play.
    */
    memset(&createsoundexinfo, 0, sizeof(FMOD_CREATESOUNDEXINFO));
    createsoundexinfo.cbsize            = sizeof(FMOD_CREATESOUNDEXINFO);              /* required. */
    createsoundexinfo.decodebuffersize  = 44100;                                       /* Chunk size of stream update in samples.  This will be the amount of data passed to the user callback. */
    createsoundexinfo.numchannels       = decodesound_channels;                        /* Number of channels in the sound. */
    createsoundexinfo.length            = decodesound_lengthbytes;                     /* Length of PCM data in bytes of whole song.  -1 = infinite. */
    createsoundexinfo.defaultfrequency  = (int)decodesound_rate;                       /* Default playback rate of sound. */
    createsoundexinfo.format            = FMOD_SOUND_FORMAT_PCM16;                     /* Data format of sound. */
    createsoundexinfo.pcmreadcallback   = pcmreadcallback;                             /* User callback for reading. */
    createsoundexinfo.pcmsetposcallback = pcmsetposcallback;                           /* User callback for seeking. */

    result = FMOD_System_CreateStream(system, 0, FMOD_2D | FMOD_OPENUSER | FMOD_LOOP_NORMAL, &createsoundexinfo, &sound);
    ERRCHECK(result);

    printf("============================================================================\n");
    printf("Manual Decode example.  Copyright (c) Firelight Technologies 2004-2011.\n");
    printf("============================================================================\n");
    printf("Sound played here decoded in realtime by the user with a 'decoder sound'    \n");
    printf("The mp3 is created as a stream opened with FMOD_OPENONLY. This is the       \n");
    printf("'decoder sound'.  The playback sound is a 16bit PCM FMOD_OPENUSER created   \n");
    printf("sound with a pcm read callback.  When the callback happens, we call readData\n");
    printf("on the decoder sound and use the pcmreadcallback data pointer as the parameter.\n");
    printf("============================================================================\n");
    printf("\n");
    printf("Press space to pause, Esc to quit\n");
    printf("Press '<' to rewind 1 second.\n");
    printf("Press '>' to fast forward 1 second.\n");
    printf("\n");

    /*
        Play the sound.
    */

    result = FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, sound, 0, &channel);
    ERRCHECK(result);

    /*
        Main loop.
    */
    do
    {
        if (_kbhit())
        {
            key = _getch();

            switch (key)
            {
                case ' ' :
                {
                    int paused;
                    FMOD_Channel_GetPaused(channel, &paused);
                    FMOD_Channel_SetPaused(channel, !paused);
                    break;
                }
                case '<' :
                {
                    unsigned int position;

                    FMOD_Channel_GetPosition(channel, &position, FMOD_TIMEUNIT_MS);
                    if (position >= 1000)
                    {
                        position -= 1000;
                    }
                    FMOD_Channel_SetPosition(channel, position, FMOD_TIMEUNIT_MS);
                    break;
                }
                case '>' :
                {
                    unsigned int position;

                    FMOD_Channel_GetPosition(channel, &position, FMOD_TIMEUNIT_MS);
                    position += 1000;
                    FMOD_Channel_SetPosition(channel, position, FMOD_TIMEUNIT_MS);
                    break;
                }
            }
        }

        FMOD_System_Update(system);

        if (channel)
        {
            unsigned int ms;
            unsigned int lenms;
            int          playing;
            int          paused;

            FMOD_Channel_IsPlaying(channel, &playing);
            if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE) && (result != FMOD_ERR_CHANNEL_STOLEN))
            {
                ERRCHECK(result);
            }

            result = FMOD_Channel_GetPaused(channel, &paused);
            if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE) && (result != FMOD_ERR_CHANNEL_STOLEN))
            {
                ERRCHECK(result);
            }

            result = FMOD_Channel_GetPosition(channel, &ms, FMOD_TIMEUNIT_MS);
            if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE) && (result != FMOD_ERR_CHANNEL_STOLEN))
            {
                ERRCHECK(result);
            }

            result = FMOD_Sound_GetLength(sound, &lenms, FMOD_TIMEUNIT_MS);
            if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE) && (result != FMOD_ERR_CHANNEL_STOLEN))
            {
                ERRCHECK(result);
            }

            printf("Time %02d:%02d:%02d/%02d:%02d:%02d : %s\r", ms / 1000 / 60, ms / 1000 % 60, ms / 10 % 100, lenms / 1000 / 60, lenms / 1000 % 60, lenms / 10 % 100, paused ? "Paused " : playing ? "Playing" : "Stopped");
        }

        Sleep(20);

    } while (key != 27);

    printf("\n");

    EnterCriticalSection(&decodecrit);
    {
        /*
            Remove the sound - wait! it might be still in use!
            Instead of releasing the decode sound first we could release it last, but this protection is here to make the issue obvious.
        */
        result = FMOD_Sound_Release(decodesound);
        ERRCHECK(result);
        decodesound = 0;    /* This will make the read callback fail from now on. */
    }
    LeaveCriticalSection(&decodecrit);

    /*
        Shut down
    */
    result = FMOD_Sound_Release(sound);
    ERRCHECK(result);
    result = FMOD_System_Close(system);
    ERRCHECK(result);
    result = FMOD_System_Release(system);
    ERRCHECK(result);

    DeleteCriticalSection(&decodecrit);

    return 0;
}
Пример #14
0
bool sound_is_playing(void)
{
    FMOD_BOOL p;
    FMOD_Channel_GetPaused(_channel, &p);
    return (bool)!p;
}
Пример #15
0
int main(int argc, char *argv[])
{
    FMOD_SYSTEM      *system;
    FMOD_SOUND       *sound1, *sound2, *sound3;
    FMOD_CHANNEL     *channel = 0;
    FMOD_RESULT       result;
    int               key;
    unsigned int      version;

    /*
        Global Settings
    */
    result = FMOD_System_Create(&system);
    ERRCHECK(result);

    result = FMOD_System_GetVersion(system, &version);
    ERRCHECK(result);

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

    result = FMOD_System_Init(system, 32, FMOD_INIT_NORMAL, NULL);
    ERRCHECK(result);

    result = FMOD_System_CreateSound(system, "../media/drumloop.wav", FMOD_SOFTWARE, 0, &sound1);
    ERRCHECK(result);

    result = FMOD_Sound_SetMode(sound1, FMOD_LOOP_OFF);
    ERRCHECK(result);

    result = FMOD_System_CreateSound(system, "../media/jaguar.wav", FMOD_SOFTWARE, 0, &sound2);
    ERRCHECK(result);

    result = FMOD_System_CreateSound(system, "../media/swish.wav", FMOD_SOFTWARE, 0, &sound3);
    ERRCHECK(result);

    printf("===================================================================\n");
    printf("PlaySound Example.  Copyright (c) Firelight Technologies 2004-2011.\n");
    printf("===================================================================\n");
    printf("\n");
    printf("Press '1' to Play a mono sound using software mixing\n");
    printf("Press '2' to Play a mono sound using software mixing\n");
    printf("Press '3' to Play a stereo sound using software mixing\n");
    printf("Press 'Esc' to quit\n");
    printf("\n");

    /*
        Main loop.
    */
    do
    {
        if (kbhit())
        {
            key = getch();

            switch (key)
            {
                case '1' :
                {
                    result = FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, sound1, 0, &channel);
                    ERRCHECK(result);
                    break;
                }
                case '2' :
                {
                    result = FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, sound2, 0, &channel);
                    ERRCHECK(result);
                    break;
                }
                case '3' :
                {
                    result = FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, sound3, 0, &channel);
                    ERRCHECK(result);
                    break;
                }
            }
        }

        FMOD_System_Update(system);

        {
            unsigned int ms = 0;
            unsigned int lenms = 0;
            int          playing = 0;
            int          paused = 0;
            int          channelsplaying = 0;

            if (channel)
            {
                FMOD_SOUND *currentsound = 0;

                result = FMOD_Channel_IsPlaying(channel, &playing);
                if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE) && (result != FMOD_ERR_CHANNEL_STOLEN))
                {
                    ERRCHECK(result);
                }

                result = FMOD_Channel_GetPaused(channel, &paused);
                if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE) && (result != FMOD_ERR_CHANNEL_STOLEN))
                {
                    ERRCHECK(result);
                }

                result = FMOD_Channel_GetPosition(channel, &ms, FMOD_TIMEUNIT_MS);
                if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE) && (result != FMOD_ERR_CHANNEL_STOLEN))
                {
                    ERRCHECK(result);
                }

                FMOD_Channel_GetCurrentSound(channel, &currentsound);
                if (currentsound)
                {
                    result = FMOD_Sound_GetLength(currentsound, &lenms, FMOD_TIMEUNIT_MS);
                    if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE) && (result != FMOD_ERR_CHANNEL_STOLEN))
                    {
                        ERRCHECK(result);
                    }
                }
            }

            result = FMOD_Sound_GetLength(sound1, &lenms, FMOD_TIMEUNIT_MS);
            if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE) && (result != FMOD_ERR_CHANNEL_STOLEN))
            {
                ERRCHECK(result);
            }

            FMOD_System_GetChannelsPlaying(system, &channelsplaying);

            printf("\rTime %02d:%02d:%02d/%02d:%02d:%02d : %s : Channels Playing %2d", ms / 1000 / 60, ms / 1000 % 60, ms / 10 % 100, lenms / 1000 / 60, lenms / 1000 % 60, lenms / 10 % 100, paused ? "Paused " : playing ? "Playing" : "Stopped", channelsplaying);
            fflush(stdout);
        }

        Sleep(10);

    } while (key != 27);

    printf("\n");

    /*
        Shut down
    */
    result = FMOD_Sound_Release(sound1);
    ERRCHECK(result);
    result = FMOD_Sound_Release(sound2);
    ERRCHECK(result);
    result = FMOD_Sound_Release(sound3);
    ERRCHECK(result);
    result = FMOD_System_Close(system);
    ERRCHECK(result);
    result = FMOD_System_Release(system);
    ERRCHECK(result);

    return 0;
}
Пример #16
0
int main(int argc, char *argv[])
{
    FMOD_SYSTEM      *system;
    FMOD_SOUND       *sound;
    FMOD_CHANNEL     *channel = 0;
    FMOD_RESULT       result;
    int               key;
    unsigned int      version;

    /*
        Create a System object and initialize.
    */
    result = FMOD_System_Create(&system);
    ERRCHECK(result);

    result = FMOD_System_GetVersion(system, &version);
    ERRCHECK(result);

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

    result = FMOD_System_Init(system, 1, FMOD_INIT_NORMAL, NULL);
    ERRCHECK(result);

    result = FMOD_System_SetFileSystem(system, myopen, myclose, myread, myseek, 0, 0, 2048);
    ERRCHECK(result);

    result = FMOD_System_CreateStream(system, "../media/wave.mp3", FMOD_HARDWARE | FMOD_LOOP_NORMAL | FMOD_2D, 0, &sound);
    ERRCHECK(result);

    printf("====================================================================\n");
    printf("PlayStream Example.  Copyright (c) Firelight Technologies 2004-2011.\n");
    printf("====================================================================\n");
    printf("\n");
    printf("Press space to pause, Esc to quit\n");
    printf("\n");

    /*
        Play the sound.
    */

    result = FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, sound, 0, &channel);
    ERRCHECK(result);

    /*
        Main loop.
    */
    do
    {
        if (kbhit())
        {
            key = getch();

            switch (key)
            {
                case ' ' :
                {
                    int paused;
                    FMOD_Channel_GetPaused(channel, &paused);
                    FMOD_Channel_SetPaused(channel, !paused);
                    break;
                }
            }
        }

        FMOD_System_Update(system);

        if (channel)
        {
            unsigned int ms;
            unsigned int lenms;
            int          playing;
            int          paused;

            FMOD_Channel_IsPlaying(channel, &playing);
            if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE) && (result != FMOD_ERR_CHANNEL_STOLEN))
            {
                ERRCHECK(result);
            }

            result = FMOD_Channel_GetPaused(channel, &paused);
            if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE) && (result != FMOD_ERR_CHANNEL_STOLEN))
            {
                ERRCHECK(result);
            }

            result = FMOD_Channel_GetPosition(channel, &ms, FMOD_TIMEUNIT_MS);
            if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE) && (result != FMOD_ERR_CHANNEL_STOLEN))
            {
                ERRCHECK(result);
            }

            result = FMOD_Sound_GetLength(sound, &lenms, FMOD_TIMEUNIT_MS);
            if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE) && (result != FMOD_ERR_CHANNEL_STOLEN))
            {
                ERRCHECK(result);
            }

            printf("\rTime %02d:%02d:%02d/%02d:%02d:%02d : %s", ms / 1000 / 60, ms / 1000 % 60, ms / 10 % 100, lenms / 1000 / 60, lenms / 1000 % 60, lenms / 10 % 100, paused ? "Paused " : playing ? "Playing" : "Stopped");
            fflush(stdout);
        }

        Sleep(10);

    } while (key != 27);

    printf("\n");

    /*
        Shut down
    */
    result = FMOD_Sound_Release(sound);
    ERRCHECK(result);
    result = FMOD_System_Close(system);
    ERRCHECK(result);
    result = FMOD_System_Release(system);
    ERRCHECK(result);

    return 0;
}
Пример #17
0
int main(int argc, char *argv[])
{
    FMOD_SYSTEM     *system;
    FMOD_SOUND      *sound;
    FMOD_CHANNEL    *channel = 0;
    FMOD_RESULT      result;
    int              key;
    unsigned int     version;

    printf("===================================================================\n");
    printf("NetStream Example.  Copyright (c) Firelight Technologies 2004-2011.\n");
    printf("===================================================================\n\n");

    if (argc < 2)
    {
        printf("Usage:   netstream <url>\n");
        printf("Example: netstream http://www.fmod.org/stream.mp3\n\n");
        return -1;
    }

    /*
        Create a System object and initialize.
    */
    result = FMOD_System_Create(&system);
    ERRCHECK(result);

    result = FMOD_System_GetVersion(system,&version);
    ERRCHECK(result);

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

    result = FMOD_System_Init(system, 1, FMOD_INIT_NORMAL, 0);
    ERRCHECK(result);

    /*
        Bump up the file buffer size a little bit for netstreams (to account for lag).
    */
    result = FMOD_System_SetStreamBufferSize(system, 64*1024, FMOD_TIMEUNIT_RAWBYTES);
    ERRCHECK(result);

    result = FMOD_System_CreateSound(system, argv[1], FMOD_HARDWARE | FMOD_2D | FMOD_CREATESTREAM | FMOD_NONBLOCKING,  0, &sound);
    ERRCHECK(result);

    printf("Press space to pause, Esc to quit\n\n");

    /*
        Main loop
    */
    do
    {
        unsigned int    ms = 0, percent = 0;
        int             playing = FALSE;
        int             paused = FALSE;
        int             starving = FALSE;
        FMOD_OPENSTATE  openstate;

        if (!channel)
        {
            result = FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, sound, FALSE, &channel);
        }

        if (_kbhit())
        {
            key = _getch();

            switch (key)
            {
                case ' ' :
                {
                    if (channel)
                    {
                        int paused;
                        FMOD_Channel_GetPaused(channel, &paused);
                        FMOD_Channel_SetPaused(channel, !paused);
                    }
                    break;
                }
            }
        }

        FMOD_System_Update(system);

        for (;;)
        {
            FMOD_TAG tag;
            if (FMOD_Sound_GetTag(sound, 0, -1, &tag) != FMOD_OK)
            {
                break;
            }
            if (tag.datatype == FMOD_TAGDATATYPE_STRING)
            {
                printf("%s = %s (%d bytes)       \n", tag.name, tag.data, tag.datalen);
            }
            else if (tag.type == FMOD_TAGTYPE_FMOD)
            {
                if (!strcmp(tag.name, "Sample Rate Change"))
                {
                    FMOD_Channel_SetFrequency(channel, *((float *)tag.data));
                }
            }
        }

        result = FMOD_Sound_GetOpenState(sound, &openstate, &percent, &starving, 0);
        ERRCHECK(result);

        if (channel)
        {
            result = FMOD_Channel_GetPaused(channel, &paused);
            ERRCHECK(result);
            result = FMOD_Channel_IsPlaying(channel, &playing);
            ERRCHECK(result);
            result = FMOD_Channel_GetPosition(channel, &ms, FMOD_TIMEUNIT_MS);
            ERRCHECK(result);
            result = FMOD_Channel_SetMute(channel, starving);
            ERRCHECK(result);
        }

        printf("Time %02d:%02d:%02d : %s : (%3d%%%) %s     \r", ms / 1000 / 60, ms / 1000 % 60, ms / 10 % 100, openstate == FMOD_OPENSTATE_BUFFERING ? "Buffering..." : openstate == FMOD_OPENSTATE_CONNECTING ? "Connecting..." : paused ? "Paused       " : playing ? "Playing      " : "Stopped      ", percent, starving ? "STARVING" : "        ");

        Sleep(10);

    } while (key != 27);

    printf("\n");

    printf("Shutting down.\n");
    
    if (channel)
    {
        result = FMOD_Channel_Stop(channel);
        ERRCHECK(result);
    }

    /*
        If we pressed escape before it is ready, wait for it to finish opening before we release it.
    */
    do
    {
        FMOD_OPENSTATE openstate;

        result = FMOD_Sound_GetOpenState(sound, &openstate, 0, 0, 0);
        ERRCHECK(result);

        if (openstate == FMOD_OPENSTATE_READY)
        {
            break;
        }

        printf("Waiting for sound to finish opening before trying to release it....\r");

        Sleep(10);
    } while (1);

    /*
        Shut down
    */
    result = FMOD_Sound_Release(sound);
    ERRCHECK(result);
    result = FMOD_System_Close(system);
    ERRCHECK(result);
    result = FMOD_System_Release(system);
    ERRCHECK(result);

    return 0;
}
Пример #18
0
int main(int argc, char *argv[])
{
	int att = 1, motion_state = 0, status = STOP;
	float volume;

	SDL_Event event;
	SDL_Surface *ecran = NULL, *fond = NULL, *play = NULL, *stop = NULL, *pause = NULL, *volumeup = NULL, *volumedown = NULL, *spectrum = NULL;
	SDL_Surface *iplay = NULL, *ipause = NULL, *istop = NULL, *ivolup = NULL, *ivoldo = NULL;

	SDL_Rect pos_fond, pos_spect, pos_play, pos_pause, pos_stop, pos_volumeup, pos_volumedown;

	printf("Démarrage de Freqalyzer\n");

	FMOD_SYSTEM *system;
	FMOD_SOUND *sound;
	FMOD_CHANNEL *channel=0;
	FMOD_RESULT result;
	FMOD_BOOL state;
	void *extradriverdata = 0;

	pos_fond.x = 0;
	pos_fond.y = 0;
	pos_spect.x = 100;
	pos_spect.y = 150;
	pos_play.x = 100;
	pos_play.y = 520;
	pos_pause.x = 100 + CONTROLLER_SIZE;
	pos_pause.y = 520;
	pos_stop.x = 100 + (CONTROLLER_SIZE * 2);
	pos_stop.y = 520;
	pos_volumeup.x = 100 + (CONTROLLER_SIZE * 3);
	pos_volumeup.y = 520;
	pos_volumedown.x = 100 + (CONTROLLER_SIZE * 4);
	pos_volumedown.y = 520;

	//Chargement en mémoire du système d'affichage SDL - Vidéo
	SDL_Init(SDL_INIT_VIDEO);

	if(SDL_Init(SDL_INIT_VIDEO) == -1)
	{
		fprintf(stderr, "Erreur d'initialisation de la SDL");
		exit(EXIT_FAILURE);
	}

	//Paramétrage et ouverture de la fenêtre
	ecran =  SDL_SetVideoMode(800, 600, 32, SDL_HWSURFACE | SDL_DOUBLEBUF);

	spectrum = SDL_CreateRGBSurface(SDL_HWSURFACE, 600, 350, 32, 0, 0, 0, 0);
	SDL_FillRect(spectrum, NULL, SDL_MapRGB(ecran->format, 0, 0, 0));

	//Titrage de la fenêtre
	SDL_WM_SetCaption("Freqalyzer", NULL);

	//Chargement des images
	fond = IMG_Load("../pictures/fond.jpg");
	W_GestionErreur(P_IMAGE, 0, fond, "fond.jpg");

	play = IMG_Load("../pictures/play.jpg");
	W_GestionErreur(P_IMAGE, 0, play, "play.jpg");

	pause = IMG_Load("../pictures/pause.jpg");
	W_GestionErreur(P_IMAGE, 0, pause, "pause.jpg");

	stop = IMG_Load("../pictures/stop.jpg");
	W_GestionErreur(P_IMAGE, 0, stop, "stop.jpg");

	volumeup = IMG_Load("../pictures/volume_up.jpg");
	W_GestionErreur(P_IMAGE, 0, volumeup, "volume_up.jpg");

	volumedown = IMG_Load("../pictures/volume_down.jpg");
	W_GestionErreur(P_IMAGE, 0, volumedown, "volume_down.jpg");

	iplay = IMG_Load("../pictures/iplay.jpg");
	W_GestionErreur(P_IMAGE, 0, iplay, "iplay.jpg");

	ipause = IMG_Load("../pictures/ipause.jpg");
	W_GestionErreur(P_IMAGE, 0, ipause, "ipause.jpg");

	istop = IMG_Load("../pictures/istop.jpg");
	W_GestionErreur(P_IMAGE, 0, istop, "istop.jpg");

	ivolup = IMG_Load("../pictures/ivolume_up.jpg");
	W_GestionErreur(P_IMAGE, 0, ivolup, "ivolume_up.jpg");

	ivoldo = IMG_Load("../pictures/ivolume_down.jpg");
	W_GestionErreur(P_IMAGE, 0, ivoldo, "ivolume_down.jpg");

	//Allocation de mémoire à system
	result = FMOD_System_Create(&system);
	W_GestionErreur(P_CREASON, result, NULL, "");

	//Initialisation
	result = FMOD_System_Init(system, 32, FMOD_INIT_NORMAL, extradriverdata);
	W_GestionErreur(P_CHARGSON, result, NULL, "");

	result = FMOD_System_CreateSound(system, "../sounds/radio_sig.mp3", FMOD_2D | FMOD_CREATESTREAM, 0, &sound);

/*	//Chargement du son
	result = FMOD_System_CreateSound(system, argv[1], FMOD_2D | FMOD_CREATESTREAM, 0, &sound);
	if (result != 0)
	{
		printf("\nErreur de saisie, veuillez taper un chemin correct \n(ex : ./Freqalyser ../sounds/gameofthrones.mp3)\n");
		exit(EXIT_FAILURE);
	}*/

	while(att)
	{
		SDL_WaitEvent(&event);

		if (event.motion.x > 100 && event.motion.x < (100 + CONTROLLER_SIZE * 5) && event.motion.y > 520 && event.motion.y < (520 + CONTROLLER_SIZE))
		{
			motion_state = 1;
			W_event(ecran, iplay, ipause, istop, ivolup, ivoldo);
		}else
			motion_state = 0;

		switch(event.type)
		{
			case SDL_QUIT:
				att = 0;
				break;
			case SDL_MOUSEBUTTONUP:
				if (event.button.x > 100 && event.button.x < (100 + CONTROLLER_SIZE) && event.button.y > 520 && event.button.y < (520 + CONTROLLER_SIZE))
				{
					//jouer le son et mettre en pause le programme le temps de sa lecture
					result=FMOD_System_PlaySound(system, sound, 0, 0, &channel);
					W_GestionErreur(P_LECTURE, result, NULL, "");
					unsigned int length;
					FMOD_Sound_GetLength(sound, &length, FMOD_TIMEUNIT_MS);
					FMOD_Channel_GetVolume(channel, &volume);
					FMOD_Channel_GetVolume(channel, &volume);
					status = PLAY;
				}
				if (event.button.x > (100 + CONTROLLER_SIZE) && event.button.x < (100 + (CONTROLLER_SIZE * 2)) && event.button.y > 520 && event.button.y < (520 + CONTROLLER_SIZE))
				{
					FMOD_System_GetChannel(system, 512, &channel);
					FMOD_Channel_GetPaused(channel, &state);
					if(state)
					{
						FMOD_Channel_SetPaused(channel, 0);
						status = PLAY;
					}
					else
					{
						FMOD_Channel_SetPaused(channel, 1);
						status = PAUSE;
					}
				}
				if (event.button.x > (100 + CONTROLLER_SIZE * 2) && event.button.x < (100 + CONTROLLER_SIZE * 3) && event.button.y > 520 && event.button.y < (520 + CONTROLLER_SIZE))
				{
					FMOD_Channel_Stop(channel);
					status = STOP;
				}
				if (event.button.x > (100 + CONTROLLER_SIZE * 3) && event.button.x < (100 + CONTROLLER_SIZE * 4) && event.button.y > 520 && event.button.y < (520 + CONTROLLER_SIZE))
					result = W_GestionVolume(&volume, channel, UP);
				if (event.button.x > (100 + CONTROLLER_SIZE * 4) && event.button.x < (100 + CONTROLLER_SIZE * 5) && event.button.y > 520 && event.button.y < (520 + CONTROLLER_SIZE))
					result = W_GestionVolume(&volume, channel, DOWN);
				break;
			case SDL_KEYDOWN:
				switch (event.key.keysym.sym)
				{
					case SDLK_ESCAPE:
 						att = 0;
						break;
					case SDLK_SPACE:
						//jouer le son et mettre en pause le programme le temps de sa lecture
						result=FMOD_System_PlaySound(system, sound, 0, 0, &channel);
						unsigned int length;
						FMOD_Sound_GetLength(sound, &length, FMOD_TIMEUNIT_MS);
						FMOD_Channel_GetVolume(channel, &volume);
						FMOD_Channel_GetVolume(channel, &volume);
						status = PLAY;
						break;
					case SDLK_UP:
						result = W_GestionVolume(&volume, channel, UP);
						break;
					case SDLK_DOWN:
						result = W_GestionVolume(&volume, channel, DOWN);
						break;
					case SDLK_p:
						FMOD_System_GetChannel(system, 512, &channel);
						FMOD_Channel_GetPaused(channel, &state);
						if(state)
						{
							FMOD_Channel_SetPaused(channel, 0);
							status = PLAY;
						}
						else
						{
							FMOD_Channel_SetPaused(channel, 1);
							status = PAUSE;
						}
						break;
					case SDLK_s:
						FMOD_Channel_Stop(channel);
						status = STOP;
						break;
					default:
						break;
					}
			default:
				break;
		}

		//Affichage des surfaces
		SDL_BlitSurface(fond, NULL, ecran, &pos_fond);
		SDL_BlitSurface(spectrum, NULL, ecran, &pos_spect);
		switch (status)
		{
			case PLAY:
				SDL_BlitSurface(iplay, NULL, ecran, &pos_play);
				SDL_BlitSurface(pause, NULL, ecran, &pos_pause);
				SDL_BlitSurface(stop, NULL, ecran, &pos_stop);
				break;
			case PAUSE:
				SDL_BlitSurface(play, NULL, ecran, &pos_play);
				SDL_BlitSurface(ipause, NULL, ecran, &pos_pause);
				SDL_BlitSurface(stop, NULL, ecran, &pos_stop);
				break;
			case STOP:
				SDL_BlitSurface(play, NULL, ecran, &pos_play);
				SDL_BlitSurface(pause, NULL, ecran, &pos_pause);
				SDL_BlitSurface(istop, NULL, ecran, &pos_stop);
				break;
			default:
				break;
		}
		SDL_BlitSurface(volumeup, NULL, ecran, &pos_volumeup);
		SDL_BlitSurface(volumedown, NULL, ecran, &pos_volumedown);

		//Rafraîchissement de la fenêtre
		SDL_Flip(ecran);
		FMOD_System_Update(system);
	}

	//Fermeture et libération de l'objet system en mémoire
	FMOD_Sound_Release(sound);
	FMOD_System_Close(system);
	FMOD_System_Release(system);

	SDL_FreeSurface(spectrum);
	SDL_FreeSurface(fond);
	SDL_FreeSurface(play);
	SDL_FreeSurface(pause);
	SDL_FreeSurface(stop);
	SDL_FreeSurface(volumeup);
	SDL_FreeSurface(volumedown);
	SDL_FreeSurface(iplay);
	SDL_FreeSurface(ipause);
	SDL_FreeSurface(istop);
	SDL_FreeSurface(ivolup);
	SDL_FreeSurface(ivoldo);

	SDL_Quit();

	return EXIT_SUCCESS;
}
Пример #19
0
FMOD_RESULT bmx_FMOD_Channel_GetPaused(MAX_FMOD_CHANNEL *channel, FMOD_BOOL * paused) {
	return FMOD_Channel_GetPaused(channel->channel, paused);
}
Пример #20
0
int main(int argc, char *argv[])
{
    FMOD_SYSTEM      *system;
    FMOD_SOUND       *sound;
    FMOD_SOUND       *subsound[2];
    FMOD_CREATESOUNDEXINFO exinfo;
    FMOD_CHANNEL     *channel = 0;
    FMOD_RESULT       result;
    int               key;
    unsigned int      subsoundid, sentenceid;
    unsigned int      version;
    const char       *soundname[NUMSOUNDS] = 
    {
        "../media/e.ogg",   /* Ma-    */
        "../media/d.ogg",   /* ry     */
        "../media/c.ogg",   /* had    */
        "../media/d.ogg",   /* a      */
        "../media/e.ogg",   /* lit-   */
        "../media/e.ogg",   /* tle    */
        "../media/e.ogg",   /* lamb,  */
        "../media/e.ogg",   /* .....  */
        "../media/d.ogg",   /* lit-   */
        "../media/d.ogg",   /* tle    */
        "../media/d.ogg",   /* lamb,  */
        "../media/d.ogg",   /* .....  */
        "../media/e.ogg",   /* lit-   */
        "../media/e.ogg",   /* tle    */
        "../media/e.ogg",   /* lamb,  */
        "../media/e.ogg",   /* .....  */

        "../media/e.ogg",   /* Ma-    */
        "../media/d.ogg",   /* ry     */
        "../media/c.ogg",   /* had    */
        "../media/d.ogg",   /* a      */
        "../media/e.ogg",   /* lit-   */
        "../media/e.ogg",   /* tle    */
        "../media/e.ogg",   /* lamb,  */
        "../media/e.ogg",   /* its    */
        "../media/d.ogg",   /* fleece */
        "../media/d.ogg",   /* was    */
        "../media/e.ogg",   /* white  */
        "../media/d.ogg",   /* as     */
        "../media/c.ogg",   /* snow.  */
        "../media/c.ogg",   /* .....  */
        "../media/c.ogg",   /* .....  */
        "../media/c.ogg",   /* .....  */
    };

    /*
        Create a System object and initialize.
    */
    result = FMOD_System_Create(&system);
    ERRCHECK(result);

    result = FMOD_System_GetVersion(system, &version);
    ERRCHECK(result);

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

    result = FMOD_System_Init(system, 1, FMOD_INIT_NORMAL, NULL);
    ERRCHECK(result);

    /*
        Set up the FMOD_CREATESOUNDEXINFO structure for the user stream with room for 2 subsounds. (our subsound double buffer)
    */
    memset(&exinfo, 0, sizeof(FMOD_CREATESOUNDEXINFO));
    
    exinfo.cbsize = sizeof(FMOD_CREATESOUNDEXINFO);
    exinfo.defaultfrequency = 44100;
    exinfo.numsubsounds = 2;
    exinfo.numchannels = 1;
    exinfo.format = FMOD_SOUND_FORMAT_PCM16;

    /*
        Create the 'parent' stream that contains the substreams.  Set it to loop so that it loops between subsound 0 and 1.
    */
    result = FMOD_System_CreateStream(system, 0, FMOD_LOOP_NORMAL | FMOD_OPENUSER, &exinfo, &sound);
    ERRCHECK(result);

    /*
        Add 2 of our streams as children of the parent.  They should be the same format (ie mono/stereo and bitdepth) as the parent sound.
        When subsound 0 has finished and it is playing subsound 1, we will swap subsound 0 with a new sound, and the same for when subsound 1 has finished,
        causing a continual double buffered flip, which means continuous sound.
    */
    result = FMOD_System_CreateStream(system, soundname[0], FMOD_DEFAULT, 0, &subsound[0]);
    ERRCHECK(result);

    result = FMOD_System_CreateStream(system, soundname[1], FMOD_DEFAULT, 0, &subsound[1]);
    ERRCHECK(result);

    result = FMOD_Sound_SetSubSound(sound, 0, subsound[0]);
    ERRCHECK(result);

    result = FMOD_Sound_SetSubSound(sound, 1, subsound[1]);
    ERRCHECK(result);

    /*
        Set up the gapless sentence to contain these first 2 streams.
    */
    {
        int soundlist[2] = { 0, 1 };
     
        result = FMOD_Sound_SetSubSoundSentence(sound, soundlist, 2);
        ERRCHECK(result);
    }

    subsoundid = 0;     
    sentenceid = 2;     /* The next sound to be appeneded to the stream. */

    printf("=============================================================================\n");
    printf("Real-time stitching example.  Copyright (c) Firelight Technologies 2004-2014.\n");
    printf("=============================================================================\n");
    printf("\n");
    printf("Press space to pause, Esc to quit\n");
    printf("\n");

    printf("Inserted subsound %d / 2 with sound %d / %d\n", 0, 0, NUMSOUNDS);
    printf("Inserted subsound %d / 2 with sound %d / %d\n", 1, 1, NUMSOUNDS);

    /*
        Play the sound.
    */

    result = FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, sound, FALSE, &channel);
    ERRCHECK(result);

    /*
        Main loop.
    */
    do
    {
        unsigned int currentsubsoundid;

        if (_kbhit())
        {
            key = _getch();

            switch (key)
            {
                case ' ' :
                {
                    int paused;
                    FMOD_Channel_GetPaused(channel, &paused);
                    FMOD_Channel_SetPaused(channel, !paused);
                    break;
                }
            }
        }

        FMOD_System_Update(system);

        /*
            Replace the subsound that just finished with a new subsound, to create endless seamless stitching!

            Note that this polls the currently playing subsound using the FMOD_TIMEUNIT_BUFFERED flag.  
            Remember streams are decoded / buffered ahead in advance! 
            Don't use the 'audible time' which is FMOD_TIMEUNIT_SENTENCE_SUBSOUND by itself.  When streaming, sound is 
            processed ahead of time, and things like stream buffer / sentence manipulation (as done below) is required 
            to be in 'buffered time', or else there will be synchronization problems and you might end up releasing a
            sub-sound that is still playing!
        */
        result = FMOD_Channel_GetPosition(channel, &currentsubsoundid, (FMOD_TIMEUNIT)(FMOD_TIMEUNIT_SENTENCE_SUBSOUND | FMOD_TIMEUNIT_BUFFERED));
        ERRCHECK(result);

        if (currentsubsoundid != subsoundid)
        {
            /* 
                Release the sound that isn't playing any more. 
            */
            result = FMOD_Sound_Release(subsound[subsoundid]);       
            ERRCHECK(result);
   
            /* 
                Replace it with a new sound in our list.
            */
            result = FMOD_System_CreateStream(system, soundname[sentenceid], FMOD_DEFAULT, 0, &subsound[subsoundid]);
            ERRCHECK(result);

            result = FMOD_Sound_SetSubSound(sound, subsoundid, subsound[subsoundid]);
            ERRCHECK(result);

            printf("Replacing subsound %d / 2 with sound %d / %d\n", subsoundid, sentenceid, NUMSOUNDS);

            sentenceid++;
            if (sentenceid >= NUMSOUNDS)
            {
                sentenceid = 0;
            }

            subsoundid = currentsubsoundid;
        }
        
        Sleep(50);

    } while (key != 27);

    printf("\n");

    /*
        Shut down
    */
    result = FMOD_Sound_Release(sound);     /* Freeing a parent subsound also frees its children. */
    ERRCHECK(result);
    result = FMOD_System_Close(system);
    ERRCHECK(result);
    result = FMOD_System_Release(system);
    ERRCHECK(result);

    return 0;
}
Пример #21
0
int main(int argc, char *argv[])
{
    FMOD_SYSTEM    *system;
    FMOD_SOUND     *fsb;
    FMOD_CHANNEL   *channel = 0;
    FMOD_RESULT     result;
    int             key, count, numsubsounds;
    unsigned int    version;

    /*
        Create a System object and initialize.
    */
    result = FMOD_System_Create(&system);
    ERRCHECK(result);

    result = FMOD_System_GetVersion(system, &version);
    ERRCHECK(result);

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

    result = FMOD_System_Init(system, 32, FMOD_INIT_NORMAL, 0);
    ERRCHECK(result);

    result = FMOD_System_CreateSound(system, "../media/example.fsb", FMOD_DEFAULT, 0, &fsb);
    ERRCHECK(result);

    printf("===================================================================\n");
    printf("FSB Example.  Copyright (c) Firelight Technologies 2004-2014.\n");
    printf("===================================================================\n");
    printf("\n");

    result = FMOD_Sound_GetNumSubSounds(fsb, &numsubsounds);
    ERRCHECK(result);

    for (count = 0; count < numsubsounds; count++)
    {
        FMOD_SOUND *subsound;
        char name[256];

        result = FMOD_Sound_GetSubSound(fsb, count, &subsound);
        ERRCHECK(result);

        result = FMOD_Sound_GetName(subsound, name, 256);
        ERRCHECK(result);

        printf("Press '%c' to play \"%s\"\n", '1' + count, name);
    }
    printf("Press 'Esc' to quit\n");
    printf("\n");

    /*
        Main loop.
    */
    do
    {
        if (_kbhit())
        {
            key = _getch();

            if (key >= '1' && key < '1' + numsubsounds)
            {
                FMOD_SOUND *subsound;
                int index = key - '1';

                FMOD_Sound_GetSubSound(fsb, index, &subsound);
               
                result = FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, subsound, FALSE, &channel);
                ERRCHECK(result);
            }
        }

        FMOD_System_Update(system);

        {
            unsigned int ms = 0;
            unsigned int lenms = 0;
            int          playing = 0;
            int          paused = 0;
            int          channelsplaying = 0;

            if (channel)
            {
                FMOD_SOUND *currentsound = 0;

                result = FMOD_Channel_IsPlaying(channel, &playing);
                if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE) && (result != FMOD_ERR_CHANNEL_STOLEN))
                {
                    ERRCHECK(result);
                }

                result = FMOD_Channel_GetPaused(channel, &paused);
                if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE) && (result != FMOD_ERR_CHANNEL_STOLEN))
                {
                    ERRCHECK(result);
                }

                result = FMOD_Channel_GetPosition(channel, &ms, FMOD_TIMEUNIT_MS);
                if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE) && (result != FMOD_ERR_CHANNEL_STOLEN))
                {
                    ERRCHECK(result);
                }
               
                FMOD_Channel_GetCurrentSound(channel, &currentsound);
                if (currentsound)
                {
                    result = FMOD_Sound_GetLength(currentsound, &lenms, FMOD_TIMEUNIT_MS);
                    if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE) && (result != FMOD_ERR_CHANNEL_STOLEN))
                    {
                        ERRCHECK(result);
                    }
                }
            }

            FMOD_System_GetChannelsPlaying(system, &channelsplaying);

            printf("Time %02d:%02d:%02d/%02d:%02d:%02d : %s : Channels Playing %2d\r", ms / 1000 / 60, ms / 1000 % 60, ms / 10 % 100, lenms / 1000 / 60, lenms / 1000 % 60, lenms / 10 % 100, paused ? "Paused " : playing ? "Playing" : "Stopped", channelsplaying);
        }

        Sleep(10);

    } while (key != 27);

    printf("\n");

    /*
        Shut down
    */
    result = FMOD_Sound_Release(fsb);
    ERRCHECK(result);
    result = FMOD_System_Close(system);
    ERRCHECK(result);
    result = FMOD_System_Release(system);
    ERRCHECK(result);

    return 0;
}
Пример #22
0
void        FMODSound::pause(void)
{
  FMOD_Channel_GetPaused(this->_channel, &(this->_tmp));
  if (this->_tmp == false)
    FMOD_Channel_SetPaused(this->_channel, true);
}
Пример #23
0
int main(int argc, char *argv[])
{
    FMOD_SYSTEM     *system;
    FMOD_SOUND      *cdsound;
    FMOD_SOUND      *sound;
    FMOD_CHANNEL    *channel = 0;
    FMOD_RESULT      result;
    int              key, numtracks, currenttrack = 0;
    unsigned int     version;

    if (argc < 2)
    {
        printf("Usage: cdplayer <volumename>\n");
        printf("Example: cdplayer \"Audio CD\"\n");
        exit(-1);
    }

    printf("==================================================================\n");
    printf("CDPlayer Example.  Copyright (c) Firelight Technologies 2004-2011.\n");
    printf("==================================================================\n\n");

    /*
        Create a System object and initialize.
    */
    result = FMOD_System_Create(&system);
    ERRCHECK(result);

    result = FMOD_System_GetVersion(system, &version);
    ERRCHECK(result);

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

    result = FMOD_System_Init(system, 1, FMOD_INIT_NORMAL, NULL);
    ERRCHECK(result);

    /*
        Bump up the file buffer size a bit from the 16k default for CDDA, because it is a slower medium.
    */
    result = FMOD_System_SetStreamBufferSize(system, 64*1024, FMOD_TIMEUNIT_RAWBYTES);
    ERRCHECK(result);

    result = FMOD_System_CreateStream(system, argv[1], FMOD_OPENONLY, 0, &cdsound);
    ERRCHECK(result);
    result = FMOD_Sound_GetNumSubSounds(cdsound, &numtracks);
    ERRCHECK(result);
    result = FMOD_Sound_GetSubSound(cdsound, currenttrack, &sound);
    ERRCHECK(result);

    for (;;)
    {
        FMOD_TAG tag;

        if (FMOD_Sound_GetTag(cdsound, 0, -1, &tag) != FMOD_OK)
        {
            break;
        }
        if (tag.datatype == FMOD_TAGDATATYPE_CDTOC)
        {
            dump_cddb_query((FMOD_CDTOC *)tag.data);
        }
    }

    printf("\n========================================\n");
    printf("Press SPACE to pause\n");
    printf("      n     to skip to next track\n");
    printf("      ESC   to exit\n");
    printf("========================================\n\n");

    /*
        Print out length of entire CD.  Did you know you can also play 'cdsound' and it will play the whole CD without gaps?
    */
    {
        unsigned int lenms;

        result = FMOD_Sound_GetLength(cdsound, &lenms, FMOD_TIMEUNIT_MS);
        ERRCHECK(result);

        printf("Total CD length %02d:%02d\n\n", lenms / 1000 / 60, lenms / 1000 % 60, lenms / 10 % 100);
    }

    /*
        Play a CD track
    */
    result = FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, sound, FALSE, &channel);
    ERRCHECK(result);

    /*
        Main loop
    */
    do
    {
        if (kbhit())
        {
            key = getch();

            switch (key)
            {
                case ' ' :
                {
                    int paused;
                    FMOD_Channel_GetPaused(channel, &paused);
                    FMOD_Channel_SetPaused(channel, !paused);
                    break;
                }

                case 'n' :
                {
                    currenttrack++;
                    if (currenttrack >= numtracks)
                    {
                        currenttrack = 0;
                    }
                    result = FMOD_Sound_GetSubSound(cdsound, currenttrack, &sound);
                    ERRCHECK(result);
                    result = FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, sound, FALSE, &channel);
                    ERRCHECK(result);
                    break;
                }
            }
        }

        FMOD_System_Update(system);

        if (channel)
        {
            unsigned int ms, lenms, percent = 0;
            FMOD_BOOL    playing;
            FMOD_BOOL    paused;

            result = FMOD_Channel_GetPaused(channel, &paused);
            if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE) && (result != FMOD_ERR_CHANNEL_STOLEN))
            {
                ERRCHECK(result);
            }
            result = FMOD_Channel_IsPlaying(channel, &playing);
            if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE) && (result != FMOD_ERR_CHANNEL_STOLEN))
            {
                ERRCHECK(result);
            }
            result = FMOD_Channel_GetPosition(channel, &ms, FMOD_TIMEUNIT_MS);
            if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE) && (result != FMOD_ERR_CHANNEL_STOLEN))
            {
                ERRCHECK(result);
            }
            result = FMOD_Sound_GetLength(sound, &lenms, FMOD_TIMEUNIT_MS);
            if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE) && (result != FMOD_ERR_CHANNEL_STOLEN))
            {
                ERRCHECK(result);
            }

            printf("\rTrack %d/%d : %02d:%02d:%02d/%02d:%02d:%02d : %s", currenttrack + 1, numtracks, ms / 1000 / 60, ms / 1000 % 60, ms / 10 % 100, lenms / 1000 / 60, lenms / 1000 % 60, lenms / 10 % 100, paused ? "Paused " : playing ? "Playing" : "Stopped");
            fflush(stdout);
        }

        Sleep(10);

    } while (key != 27);

    printf("\n");

    /*
        Shut down
    */
    result = FMOD_Sound_Release(cdsound);
    ERRCHECK(result);
    result = FMOD_System_Close(system);
    ERRCHECK(result);
    result = FMOD_System_Release(system);
    ERRCHECK(result);

    return 0;
}
Пример #24
0
int main(int argc, char *argv[])
{
    FMOD_SYSTEM      *system   = 0;
    FMOD_SOUND       *playlist = 0;
    FMOD_SOUND       *sound    = 0;
    FMOD_CHANNEL     *channel  = 0;
    FMOD_TAG          tag;
    FMOD_RESULT       result;
    FMOD_SOUND_TYPE   soundtype;
    FMOD_BOOL         isplaylist = 0;
    char             *title = NULL;
    int               count = 0;
    int               key;
    unsigned int      version;
    char              file[128];   

    /*
        Create a System object and initialize.
    */
    result = FMOD_System_Create(&system);
    ERRCHECK(result);

    result = FMOD_System_GetVersion(system, &version);
    ERRCHECK(result);

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

    result = FMOD_System_Init(system, 32, FMOD_INIT_NORMAL, 0);
    ERRCHECK(result);

    result = FMOD_System_CreateSound(system, "../media/playlist.m3u", FMOD_DEFAULT, 0, &playlist);
    ERRCHECK(result);

    result = FMOD_Sound_GetFormat(playlist, &soundtype, 0, 0, 0);
    ERRCHECK(result);

    isplaylist = (soundtype == FMOD_SOUND_TYPE_PLAYLIST);

    printf("===================================================================\n");
    printf("PlayList Example.  Copyright (c) Firelight Technologies 2004-2015.\n");
    printf("===================================================================\n");
    printf("\n");
    printf("Press 'n'     to play next sound in playlist\n");
    printf("Press 'space' to pause/unpause current sound\n");
    printf("Press 'Esc'   to quit\n");
    printf("\n");

    if (isplaylist)
    {
        printf("PLAYLIST loaded.\n");
        /*
            Get the first song in the playlist, create the sound and then play it.
        */
        result = FMOD_Sound_GetTag(playlist, "FILE", count, &tag);
        ERRCHECK(result);

        sprintf(file, "../media/%s", (char *)tag.data);

        result = FMOD_System_CreateSound(system, file, FMOD_DEFAULT, 0, &sound);
        ERRCHECK(result);

        result = FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, sound, 0, &channel);
        ERRCHECK(result);

        FMOD_Sound_GetTag(playlist, "TITLE", count, &tag);
        title = (char *)tag.data;

        count++;
    }
    else
    {
        printf("SOUND loaded.\n");

        /*
            This is just a normal sound, so just play it.
        */
        sound = playlist;

        result = FMOD_Sound_SetMode(sound, FMOD_LOOP_NORMAL);
        ERRCHECK(result);

        result = FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, sound, 0, &channel);
        ERRCHECK(result);
    }

    printf("\n");

    /*
        Main loop.
    */
    do
    {
        FMOD_BOOL  isplaying = 0;

        if (channel && isplaylist)
        {
            /*
                When sound has finished playing, play the next sound in the playlist
            */

            FMOD_Channel_IsPlaying(channel, &isplaying);
            if (!isplaying)
            {
                if (sound)
                {
                    FMOD_Sound_Release(sound);

                    sound = NULL;
                }

                result = FMOD_Sound_GetTag(playlist, "FILE", count, &tag);
                if (result != FMOD_OK)
                {
                    count = 0;
                }
                else
                {
                    printf("playing next song in playlist...\n");

                    sprintf(file, "../media/%s", (char *)tag.data);

                    result = FMOD_System_CreateSound(system, file, FMOD_DEFAULT, 0, &sound);
                    ERRCHECK(result);

                    result = FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, sound, 0, &channel);
                    ERRCHECK(result);

                    FMOD_Sound_GetTag(playlist, "TITLE", count, &tag);
                    title = (char *)tag.data;

                    count++;
                }
            }
        }


        if (_kbhit())
        {
            key = _getch();

            switch (key)
            {
                case 'n' :
                {
                    /*
                        Play the next song in the playlist
                    */
                    if (channel && isplaylist)
                    {
                        FMOD_Channel_Stop(channel);
                    }

                    break;
                }
                case ' ' :
                {
                    if (channel)
                    {
                        FMOD_BOOL paused;

                        FMOD_Channel_GetPaused(channel, &paused);
                        FMOD_Channel_SetPaused(channel, !paused);
                    }
                }
            }
        }

        FMOD_System_Update(system);

        {
            unsigned int ms = 0;
            unsigned int lenms = 0;
            FMOD_BOOL    paused = 0;

            if (channel)
            {
                if (sound)
                {
                    result = FMOD_Sound_GetLength(sound, &lenms, FMOD_TIMEUNIT_MS);
                    if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE) && (result != FMOD_ERR_CHANNEL_STOLEN))
                    {
                        ERRCHECK(result);
                    }
                }

                result = FMOD_Channel_GetPaused(channel, &paused);
                if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE) && (result != FMOD_ERR_CHANNEL_STOLEN))
                {
                    ERRCHECK(result);
                }

                result = FMOD_Channel_GetPosition(channel, &ms, FMOD_TIMEUNIT_MS);
                if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE) && (result != FMOD_ERR_CHANNEL_STOLEN))
                {
                    ERRCHECK(result);
                }
            }

            printf("Time %02d:%02d:%02d/%02d:%02d:%02d : %s : %s\r", ms / 1000 / 60, ms / 1000 % 60, ms / 10 % 100, lenms / 1000 / 60, lenms / 1000 % 60, lenms / 10 % 100, paused ? "Paused " : "Playing ", title);

        }

        Sleep(10);

    } while (key != 27);

    printf("\n");

    /*
        Shut down
    */
    if (sound)
    {
        result = FMOD_Sound_Release(sound);
        ERRCHECK(result);
    }
    if (isplaylist)
    {
        result = FMOD_Sound_Release(playlist);
        ERRCHECK(result);
    }
    result = FMOD_System_Close(system);
    ERRCHECK(result);
    result = FMOD_System_Release(system);
    ERRCHECK(result);

    return 0;
}
Пример #25
0
int main(int argc, char *argv[])
{
    FMOD_SYSTEM      *system;
    FMOD_SOUND       *sound1, *sound2;
    FMOD_CHANNEL     *channel = 0;
    FMOD_RESULT       result;
    FMOD_SPEAKERMODE  speakermode;
    int               key;
    unsigned int      version;

    /*
        Create a System object and initialize.
    */
    result = FMOD_System_Create(&system);
    ERRCHECK(result);

    result = FMOD_System_GetVersion(system, &version);
    ERRCHECK(result);

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

    /* 
       Choose the speaker mode selected by the Windows control panel.
    */
    result = FMOD_System_GetDriverCaps(system, 0, 0, 0, &speakermode);
    ERRCHECK(result);

    result = FMOD_System_SetSpeakerMode(system, speakermode);
    ERRCHECK(result);

    result = FMOD_System_Init(system, 32, FMOD_INIT_NORMAL, NULL);
    ERRCHECK(result);

    result = FMOD_System_CreateSound(system, "../media/drumloop.wav", FMOD_SOFTWARE | FMOD_2D, 0, &sound1);
    ERRCHECK(result);
    result = FMOD_Sound_SetMode(sound1, FMOD_LOOP_OFF);
    ERRCHECK(result);

    result = FMOD_System_CreateSound(system, "../media/stereo.ogg", FMOD_SOFTWARE | FMOD_2D, 0,  &sound2);
    ERRCHECK(result);

    printf("==============================================================================\n");
    printf("Multi Speaker Output Example.  Copyright (c) Firelight Technologies 2004-2011.\n");
    printf("==============================================================================\n");
    printf("\n");
    switch (speakermode)
    {
        case FMOD_SPEAKERMODE_MONO    :
        {
            printf("Using control panel speaker mode : MONO.\n");
            printf("\n");
            printf("Note! This output mode is very limited in its capability.\n");
            printf("Most functionality of this demo is only realized with at least FMOD_SPEAKERMODE_QUAD\n");
            printf("and above.\n");
            break;
        }
        case FMOD_SPEAKERMODE_STEREO  :
        {
            printf("Using control panel speaker mode : STEREO.\n");
            printf("\n");
            printf("Note! This output mode is very limited in its capability.\n");
            printf("Most functionality of this demo is only realized with FMOD_SPEAKERMODE_QUAD\n");
            printf("and above.\n");
            break;
        }
        case FMOD_SPEAKERMODE_QUAD :
        {
            printf("Using control panel speaker mode : QUAD.\n");
            printf("Side left, side right, center and subwoofer mix will be disabled.\n");
            break;
        }
        case FMOD_SPEAKERMODE_SURROUND :
        {
            printf("Using control panel speaker mode : SURROUND.\n");
            printf("Side left, side right, and subwoofer mix will be disabled.\n");
            break;
        }
        case FMOD_SPEAKERMODE_5POINT1 :
        {
            printf("Using control panel speaker mode : 5.1 surround.\n");
            printf("Side left and right mix will be disabled..\n");
            break;
        }
        case FMOD_SPEAKERMODE_7POINT1 :
        {
            printf("Using control panel speaker mode : 7.1 surround.\n");
            printf("Full capability.\n");
            break;
        }
    };
    printf("\n");

    printf("Press '1' to play a mono sound on the FRONT LEFT speaker.\n");
    printf("Press '2' to play a mono sound on the FRONT RIGHT speaker.\n");

    if (speakermode >= FMOD_SPEAKERMODE_SURROUND)
    {
        printf("Press '3' to play a mono sound on the CENTER speaker.\n");
    }
    else
    {
        printf("- CENTER Disabled\n");
    }

    if (speakermode >= FMOD_SPEAKERMODE_QUAD)
    {
        printf("Press '4' to play a mono sound on the REAR LEFT speaker.\n");
        printf("Press '5' to play a mono sound on the REAR RIGHT speaker.\n");
    }
    else
    {
        printf("- REAR LEFT Disabled\n");
        printf("- REAR RIGHT Disabled\n");
    }
    if (speakermode >= FMOD_SPEAKERMODE_7POINT1)
    {
        printf("Press '6' to play a mono sound on the SIDE LEFT speaker.\n");
        printf("Press '7' to play a mono sound on the SIDE RIGHT speaker.\n");
    }
    else
    {
        printf("- SIDE LEFT Disabled\n");
        printf("- SIDE RIGHT Disabled\n");
    }

    printf("\n");
    printf("Press '8' to play a stereo sound on the front speakers.\n");
    printf("Press '9' to play a stereo sound on the front speakers but channel swapped.\n");

    if (speakermode >= FMOD_SPEAKERMODE_SURROUND)
    {
        printf("Press '0' to play the right part of a stereo sound on the CENTER speaker.\n");
    }

    printf("Press 'Esc' to quit\n");
    printf("\n");

    /*
        Main loop.
    */
    do
    {
        if (_kbhit())
        {
            key = _getch();

            switch (key)
            {
                case '1' :
                {
                    result = FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, sound1, TRUE, &channel);
                    ERRCHECK(result);

                    result = FMOD_Channel_SetSpeakerMix(channel, 1.0f, 0, 0, 0, 0, 0, 0, 0);
                    ERRCHECK(result);

                    result = FMOD_Channel_SetPaused(channel, FALSE);
                    ERRCHECK(result);
                    break;
                }
                case '2' :
                {
                    result = FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, sound1, TRUE, &channel);
                    ERRCHECK(result);

                    result = FMOD_Channel_SetSpeakerMix(channel, 0, 1.0f, 0, 0, 0, 0, 0, 0);
                    ERRCHECK(result);

                    result = FMOD_Channel_SetPaused(channel, FALSE);
                    ERRCHECK(result);
                    break;
                }
                case '3' :
                {
                    if (speakermode >= FMOD_SPEAKERMODE_QUAD)
                    {
                        result = FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, sound1, TRUE, &channel);
                        ERRCHECK(result);

                        result = FMOD_Channel_SetSpeakerMix(channel, 0, 0, 1.0f, 0, 0, 0, 0, 0);
                        ERRCHECK(result);

                        result = FMOD_Channel_SetPaused(channel, FALSE);
                        ERRCHECK(result);
                    }
                    break;
                }
                case '4' :
                {
                    if (speakermode >= FMOD_SPEAKERMODE_QUAD)
                    {
                        result = FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, sound1, TRUE, &channel);
                        ERRCHECK(result);

                        result = FMOD_Channel_SetSpeakerMix(channel, 0, 0, 0, 0, 1.0f, 0, 0, 0);
                        ERRCHECK(result);

                        result = FMOD_Channel_SetPaused(channel, FALSE);
                        ERRCHECK(result);
                    }
                    break;
                }
                case '5' :
                {
                    if (speakermode >= FMOD_SPEAKERMODE_QUAD)
                    {
                        result = FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, sound1, TRUE, &channel);
                        ERRCHECK(result);

                        result = FMOD_Channel_SetSpeakerMix(channel, 0, 0, 0, 0, 0, 1.0f, 0, 0);
                        ERRCHECK(result);

                        result = FMOD_Channel_SetPaused(channel, FALSE);
                        ERRCHECK(result);
                    }
                    break;
                }
                case '6' :
                {
                    if (speakermode >= FMOD_SPEAKERMODE_7POINT1)
                    {
                        result = FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, sound1, TRUE, &channel);
                        ERRCHECK(result);

                        result = FMOD_Channel_SetSpeakerMix(channel, 0, 0, 0, 0, 0, 0, 1.0f, 0);
                        ERRCHECK(result);

                        result = FMOD_Channel_SetPaused(channel, FALSE);
                        ERRCHECK(result);
                    }
                    break;
                }
                case '7' :
                {
                    if (speakermode >= FMOD_SPEAKERMODE_7POINT1)
                    {
                        result = FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, sound1, TRUE, &channel);
                        ERRCHECK(result);

                        result = FMOD_Channel_SetSpeakerMix(channel, 0, 0, 0, 0, 0, 0, 0, 1.0f);
                        ERRCHECK(result);

                        result = FMOD_Channel_SetPaused(channel, FALSE);
                        ERRCHECK(result);
                    }
                    break;
                }
                case '8' :
                {
                    float  levels[2] = { 0, 1.0f };

                    result = FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, sound2, TRUE, &channel);
                    ERRCHECK(result);

                    /*
                        By default a stereo sound would play in all right and all left speakers, so this forces it to just the front.
                    */
                    result = FMOD_Channel_SetSpeakerMix(channel, 1.0f, 1.0f, 0, 0, 0, 0, 0, 0);
                    ERRCHECK(result);

                    result = FMOD_Channel_SetPaused(channel, FALSE);
                    ERRCHECK(result);

                    break;
                }
                case '9' :
                {
                    result = FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, sound2, TRUE, &channel);
                    ERRCHECK(result);

                    /*
                        Clear out all speakers first.
                    */
                    result = FMOD_Channel_SetSpeakerMix(channel, 0, 0, 0, 0, 0, 0, 0, 0);
                    ERRCHECK(result);

                    /*
                        Put the left channel of the sound in the right speaker.
                    */
                    {
                        float  levels[2] = { 0, 1.0f };    /* This array represents the source stereo sound.  l/r */

                        result = FMOD_Channel_SetSpeakerLevels(channel, FMOD_SPEAKER_FRONT_LEFT, levels, 2);
                        ERRCHECK(result);
                    }
                    /*
                        Put the right channel of the sound in the left speaker.
                    */
                    {
                        float  levels[2] = { 1.0f, 0 };    /* This array represents the source stereo sound.  l/r */

                        result = FMOD_Channel_SetSpeakerLevels(channel, FMOD_SPEAKER_FRONT_RIGHT, levels, 2);
                        ERRCHECK(result);
                    }

                    result = FMOD_Channel_SetPaused(channel, FALSE);
                    ERRCHECK(result);

                    break;
                }
                case '0' :
                {
                    if (speakermode >= FMOD_SPEAKERMODE_SURROUND)   /* All formats that have a center speaker. */
                    {
                        result = FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, sound2, TRUE, &channel);
                        ERRCHECK(result);

                        /*
                            Clear out all speakers first.
                        */
                        result = FMOD_Channel_SetSpeakerMix(channel, 0, 0, 0, 0, 0, 0, 0, 0);
                        ERRCHECK(result);

                        /*
                            Put the right channel of the sound in the center speaker.
                        */
                        {
                            float  levels[2] = { 0, 1.0f };    /* This array represents the source stereo sound.  l/r */

                            result = FMOD_Channel_SetSpeakerLevels(channel, FMOD_SPEAKER_FRONT_CENTER, levels, 2);
                            ERRCHECK(result);
                        }

                        result = FMOD_Channel_SetPaused(channel, FALSE);
                        ERRCHECK(result);
                    }
                    break;
                }
            }
        }

        FMOD_System_Update(system);

        {
            unsigned int ms = 0;
            unsigned int lenms = 0;
            int          playing = FALSE;
            int          paused = FALSE;
            int          channelsplaying = 0;

            if (channel)
            {
                FMOD_SOUND *currentsound = 0;

                result = FMOD_Channel_IsPlaying(channel, &playing);
                if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE) && (result != FMOD_ERR_CHANNEL_STOLEN))
                {
                    ERRCHECK(result);
                }

                result = FMOD_Channel_GetPaused(channel, &paused);
                if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE) && (result != FMOD_ERR_CHANNEL_STOLEN))
                {
                    ERRCHECK(result);
                }

                result = FMOD_Channel_GetPosition(channel, &ms, FMOD_TIMEUNIT_MS);
                if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE) && (result != FMOD_ERR_CHANNEL_STOLEN))
                {
                    ERRCHECK(result);
                }
               
                FMOD_Channel_GetCurrentSound(channel, &currentsound);
                if (currentsound)
                {
                    result = FMOD_Sound_GetLength(currentsound, &lenms, FMOD_TIMEUNIT_MS);
                    if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE) && (result != FMOD_ERR_CHANNEL_STOLEN))
                    {
                        ERRCHECK(result);
                    }
                }
            }

            FMOD_System_GetChannelsPlaying(system, &channelsplaying);

            printf("Time %02d:%02d:%02d/%02d:%02d:%02d : %s : Channels Playing %2d\r", ms / 1000 / 60, ms / 1000 % 60, ms / 10 % 100, lenms / 1000 / 60, lenms / 1000 % 60, lenms / 10 % 100, paused ? "Paused " : playing ? "Playing" : "Stopped", channelsplaying);
        }

        Sleep(10);

    } while (key != 27);

    printf("\n");

    /*
        Shut down
    */
    result = FMOD_Sound_Release(sound1);
    ERRCHECK(result);
    result = FMOD_Sound_Release(sound2);
    ERRCHECK(result);
    result = FMOD_System_Close(system);
    ERRCHECK(result);
    result = FMOD_System_Release(system);
    ERRCHECK(result);

    return 0;
}
Пример #26
0
void Sound::Toggle_Pause() 
{
    FMOD_BOOL p;
    FMOD_Channel_GetPaused(channel, &p);
    FMOD_Channel_SetPaused(channel, !p);
}
Пример #27
0
int main(int argc, char *argv[])
{
    FMOD_SYSTEM    *system;
    FMOD_SOUND     *sound;
    FMOD_CHANNEL   *channel = 0;
    FMOD_RESULT     result;
    int             key;
    unsigned int    version;

    memset(gCurrentTrackArtist, 0, 256);
    memset(gCurrentTrackTitle, 0, 256);
    strcpy(gOutputFileName, "output.mp3");   /* Start off like this then rename if a title tag comes along */

    printf("======================================================================\n");
    printf("RipNetStream Example.  Copyright (c) Firelight Technologies 2004-2011.\n");
    printf("======================================================================\n\n");

    if (argc < 2)
    {
        printf("Usage:   ripnetstream <url>\n");
        return -1;
    }

    /*
        Create a System object and initialize.
    */
    result = FMOD_System_Create(&system);
    ERRCHECK(result);

    result = FMOD_System_GetVersion(system, &version);
    ERRCHECK(result);

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

    result = FMOD_System_Init(system, 100, FMOD_INIT_NORMAL, NULL);
    ERRCHECK(result);

    result = FMOD_System_SetStreamBufferSize(system, gFileBufferSize, FMOD_TIMEUNIT_RAWBYTES);
    ERRCHECK(result);

    result = FMOD_System_AttachFileSystem(system, myopen, myclose, myread, 0);
    ERRCHECK(result);

    printf("Buffering...\n\n");

    result = FMOD_System_CreateSound(system, argv[1], FMOD_HARDWARE | FMOD_2D | FMOD_CREATESTREAM | FMOD_NONBLOCKING, 0, &sound);
    ERRCHECK(result);

    /*
        Main loop
    */
    do
    {
        if (sound && !channel)
        {
            result = FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, sound, FALSE, &channel);
        }

        if (kbhit())
        {
            key = getch();

            switch (key)
            {
            case ' ' :
            {
                if (channel)
                {
                    int paused;
                    FMOD_Channel_GetPaused(channel, &paused);
                    FMOD_Channel_SetPaused(channel, !paused);
                }
                break;
            }
            case 'm' :
            case 'M' :
            {
                if (channel)
                {
                    int mute;
                    FMOD_Channel_GetMute(channel, &mute);
                    FMOD_Channel_SetMute(channel, !mute);
                }
                break;
            }
            }
        }

        FMOD_System_Update(system);

        if (channel)
        {
            unsigned int ms = 0;
            int          playing = FALSE;
            int          paused = FALSE;
            int          tagsupdated = 0;

            FMOD_Sound_GetNumTags(sound, 0, &tagsupdated);

            if (tagsupdated)
            {
                printf("\n");
                printf("\n");
                for (;;)
                {
                    FMOD_TAG tag;

                    if (FMOD_Sound_GetTag(sound, 0, -1, &tag) != FMOD_OK)
                    {
                        break;
                    }

                    if (tag.datatype == FMOD_TAGDATATYPE_STRING)
                    {
                        printf("[%-11s] %s (%d bytes)\n", tag.name, (char *)tag.data, tag.datalen);

                        FMOD_Sound_GetFormat(sound, &gSoundType, 0, 0, 0);

                        if (!strcmp(tag.name, "ARTIST"))
                        {
                            if (strncmp(gCurrentTrackArtist, (const char *)tag.data, 256))
                            {
                                strncpy(gCurrentTrackArtist, (const char *)tag.data, 256);
                                gUpdateFileName = TRUE;
                            }
                        }
                        if (!strcmp(tag.name, "TITLE"))
                        {
                            if (strncmp(gCurrentTrackTitle, (const char *)tag.data, 256))
                            {
                                strncpy(gCurrentTrackTitle, (const char *)tag.data, 256);
                                gUpdateFileName = TRUE;
                            }
                        }
                    }
                }
                printf("\n");
            }

            result = FMOD_Channel_IsPlaying(channel, &playing);
            if (result != FMOD_OK || !playing)
            {
                FMOD_Sound_Release(sound);
                sound = 0;
                channel = 0;
            }
            else
            {
                result = FMOD_Channel_GetPaused(channel, &paused);
                result = FMOD_Channel_GetPosition(channel, &ms, FMOD_TIMEUNIT_MS);
                printf("\rTime %02d:%02d:%02d : %s : Press SPACE to pause. 'm' to mute. ESC to quit.", ms / 1000 / 60, ms / 1000 % 60, ms / 10 % 100, paused ? "Paused " : playing ? "Playing" : "Stopped");
                fflush(stdout);
            }
        }


        if (sound)
        {
            FMOD_OPENSTATE openstate = FMOD_OPENSTATE_READY;

            FMOD_Sound_GetOpenState(sound, &openstate, 0, 0, 0);

            if (openstate == FMOD_OPENSTATE_ERROR)
            {
                FMOD_Sound_Release(sound);
                sound = 0;
                channel = 0;
            }
        }

        if (!sound)
        {
            printf("\n");
            printf("Error occurred or stream ended.  Restarting stream..\n");
            result = FMOD_System_CreateSound(system, argv[1], FMOD_HARDWARE | FMOD_2D | FMOD_CREATESTREAM | FMOD_NONBLOCKING, 0, &sound);
            ERRCHECK(result);
            Sleep(1000);
        }

        Sleep(10);

    } while (key != 27);

    printf("\n");

    /*
        Shut down
    */
    result = FMOD_Sound_Release(sound);
    ERRCHECK(result);
    result = FMOD_System_Close(system);
    ERRCHECK(result);
    result = FMOD_System_Release(system);
    ERRCHECK(result);

    return 0;
}
Пример #28
0
int main(int argc, char *argv[])
{
    FMOD_SYSTEM      *system;
    FMOD_SOUND       *sound1, *sound2, *sound3;
    FMOD_CHANNEL     *channel = 0;
    FMOD_RESULT       result;
    int               key;
    unsigned int      version;
    void             *buff = 0;
    int               length = 0;
    FMOD_CREATESOUNDEXINFO exinfo;

    /*
        Create a System object and initialize.
    */
    result = FMOD_System_Create(&system);
    ERRCHECK(result);

    result = FMOD_System_GetVersion(system, &version);
    ERRCHECK(result);

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

    result = FMOD_System_Init(system, 32, FMOD_INIT_NORMAL, NULL);
    ERRCHECK(result);

    LoadFileIntoMemory("../media/drumloop.wav", &buff, &length);
    memset(&exinfo, 0, sizeof(FMOD_CREATESOUNDEXINFO));
    exinfo.cbsize = sizeof(FMOD_CREATESOUNDEXINFO);
    exinfo.length = length;

    result = FMOD_System_CreateSound(system, (const char *)buff, FMOD_HARDWARE | FMOD_OPENMEMORY, &exinfo, &sound1);
    ERRCHECK(result);

    result = FMOD_Sound_SetMode(sound1, FMOD_LOOP_OFF);
    ERRCHECK(result);

    free(buff); // don't need the original memory any more.  Note!  If loading as a stream, the memory must stay active so do not free it!

    LoadFileIntoMemory("../media/jaguar.wav", &buff, &length);
    memset(&exinfo, 0, sizeof(FMOD_CREATESOUNDEXINFO));
    exinfo.cbsize = sizeof(FMOD_CREATESOUNDEXINFO);
    exinfo.length = length;    

    result = FMOD_System_CreateSound(system, (const char *)buff, FMOD_SOFTWARE | FMOD_OPENMEMORY, &exinfo, &sound2);
    ERRCHECK(result);

    free(buff); // don't need the original memory any more.  Note!  If loading as a stream, the memory must stay active so do not free it!

    LoadFileIntoMemory("../media/swish.wav", &buff, &length);
    memset(&exinfo, 0, sizeof(FMOD_CREATESOUNDEXINFO));
    exinfo.cbsize = sizeof(FMOD_CREATESOUNDEXINFO);
    exinfo.length = length;    

    result = FMOD_System_CreateSound(system, (const char *)buff, FMOD_HARDWARE | FMOD_OPENMEMORY, &exinfo, &sound3);
    ERRCHECK(result);

    free(buff); // don't need the original memory any more.  Note!  If loading as a stream, the memory must stay active so do not free it!

    printf("==========================================================================\n");
    printf("Load from memory example.  Copyright (c) Firelight Technologies 2004-2014.\n");
    printf("==========================================================================\n");
    printf("\n");
    printf("Press '1' to play a mono sound using hardware mixing\n");
    printf("Press '2' to play a mono sound using software mixing\n");
    printf("Press '3' to play a stereo sound using hardware mixing\n");
    printf("Press 'Esc' to quit\n");
    printf("\n");

    /*
        Main loop.
    */
    do
    {
        if (kbhit())
        {
            key = getch();

            switch (key)
            {
                case '1' :
                {
                    result = FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, sound1, 0, &channel);
                    ERRCHECK(result);
                    break;
                }
                case '2' :
                {
                    result = FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, sound2, 0, &channel);
                    ERRCHECK(result);
                    break;
                }
                case '3' :
                {
                    result = FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, sound3, 0, &channel);
                    ERRCHECK(result);
                    break;
                }
            }
        }

        FMOD_System_Update(system);

        {
            unsigned int ms = 0;
            unsigned int lenms = 0;
            int          playing = 0;
            int          paused = 0;
            int          channelsplaying = 0;

            if (channel)
            {
                FMOD_SOUND *currentsound = 0;

                result = FMOD_Channel_IsPlaying(channel, &playing);
                if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE) && (result != FMOD_ERR_CHANNEL_STOLEN))
                {
                    ERRCHECK(result);
                }

                result = FMOD_Channel_GetPaused(channel, &paused);
                if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE) && (result != FMOD_ERR_CHANNEL_STOLEN))
                {
                    ERRCHECK(result);
                }

                result = FMOD_Channel_GetPosition(channel, &ms, FMOD_TIMEUNIT_MS);
                if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE) && (result != FMOD_ERR_CHANNEL_STOLEN))
                {
                    ERRCHECK(result);
                }

                FMOD_Channel_GetCurrentSound(channel, &currentsound);
                if (currentsound)
                {
                    result = FMOD_Sound_GetLength(currentsound, &lenms, FMOD_TIMEUNIT_MS);
                    if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE) && (result != FMOD_ERR_CHANNEL_STOLEN))
                    {
                        ERRCHECK(result);
                    }
                }
            }

            result = FMOD_Sound_GetLength(sound1, &lenms, FMOD_TIMEUNIT_MS);
            if ((result != FMOD_OK) && (result != FMOD_ERR_INVALID_HANDLE) && (result != FMOD_ERR_CHANNEL_STOLEN))
            {
                ERRCHECK(result);
            }

            FMOD_System_GetChannelsPlaying(system, &channelsplaying);

            printf("\rTime %02d:%02d:%02d/%02d:%02d:%02d : %s : Channels Playing %2d", ms / 1000 / 60, ms / 1000 % 60, ms / 10 % 100, lenms / 1000 / 60, lenms / 1000 % 60, lenms / 10 % 100, paused ? "Paused " : playing ? "Playing" : "Stopped", channelsplaying);
            fflush(stdout);
        }

        Sleep(10);

    } while (key != 27);

    printf("\n");

    /*
        Shut down
    */
    result = FMOD_Sound_Release(sound1);
    ERRCHECK(result);
    result = FMOD_Sound_Release(sound2);
    ERRCHECK(result);
    result = FMOD_Sound_Release(sound3);
    ERRCHECK(result);
    result = FMOD_System_Close(system);
    ERRCHECK(result);
    result = FMOD_System_Release(system);
    ERRCHECK(result);

    return 0;
}
Пример #29
0
int main(int argc, char *argv[])
{
    FMOD_SYSTEM     *system;
    FMOD_SOUND      *cdsound;
    FMOD_CHANNEL    *channel = 0;
    FMOD_RESULT      result;
    int              key;
    unsigned int     numtracks, currenttrack = 0;
    unsigned int     version;

    printf("==================================================================\n");
    printf("CDPlayer Example.  Copyright (c) Firelight Technologies 2004-2014.\n");
    printf("==================================================================\n\n");

    /*
        Create a System object and initialize.
    */
    result = FMOD_System_Create(&system);
    ERRCHECK(result);

    result = FMOD_System_GetVersion(system, &version);
    ERRCHECK(result);

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

    result = FMOD_System_Init(system, 1, FMOD_INIT_NORMAL, NULL);
    ERRCHECK(result);

    /*
        Bump up the file buffer size a bit from the 16k default for CDDA, because it is a slower medium.
    */
    result = FMOD_System_SetStreamBufferSize(system, 64*1024, FMOD_TIMEUNIT_RAWBYTES);
    ERRCHECK(result);

    /*
        Try a few drive letters.
    */
    result = FMOD_System_CreateStream(system, "d:", FMOD_OPENONLY, 0, &cdsound);
    if (result != FMOD_OK)
    {
        result = FMOD_System_CreateStream(system, "e:", FMOD_OPENONLY, 0, &cdsound);
        if (result != FMOD_OK)
        {
            result = FMOD_System_CreateStream(system, "f:", FMOD_OPENONLY, 0, &cdsound);
            ERRCHECK(result);
        }
    }
    result = FMOD_Sound_GetNumSubSounds(cdsound, &numtracks);
    ERRCHECK(result);

    for (;;)
    {
        FMOD_TAG tag;

        if (FMOD_Sound_GetTag(cdsound, 0, -1, &tag) != FMOD_OK)
        {
            break;
        }
        if (tag.datatype == FMOD_TAGDATATYPE_CDTOC)
        {
            dump_cddb_query((FMOD_CDTOC *)tag.data);
        }
    }

    printf("\n========================================\n");
    printf("Press SPACE to pause\n");
    printf("      n     to skip to next track\n");
    printf("      <     re-wind 10 seconds\n");
    printf("      >     fast-forward 10 seconds\n");
    printf("      ESC   to exit\n");
    printf("========================================\n\n");

    /*
        Print out length of entire CD.  Did you know you can also play 'cdsound' and it will play the whole CD without gaps?
    */
    {
        unsigned int lenms;

        result = FMOD_Sound_GetLength(cdsound, &lenms, FMOD_TIMEUNIT_MS);
        ERRCHECK(result);

        printf("Total CD length %02d:%02d\n\n", lenms / 1000 / 60, lenms / 1000 % 60, lenms / 10 % 100);
    }

    /*
        Play whole CD
    */
    result = FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, cdsound, FALSE, &channel);
    ERRCHECK(result);

    /*
        Main loop
    */
    do
    {
        if (_kbhit())
        {
            key = _getch();

            switch (key)
            {
                case ' ' :
                {
                    int paused;
                    FMOD_Channel_GetPaused(channel, &paused);
                    FMOD_Channel_SetPaused(channel, !paused);
                    break;
                }

                case '<' :
                {
                    unsigned int ms;

                    FMOD_Channel_GetPosition(channel, &ms, FMOD_TIMEUNIT_SENTENCE_MS);

                    if (ms >= 10000)
                    {
                        ms -= 10000;
                    }
                    else
                    {
                        ms = 0;
                    }

                    FMOD_Channel_SetPosition(channel, ms, FMOD_TIMEUNIT_SENTENCE_MS);
                    break;
                }

                case '>' :
                {
                    unsigned int ms;

                    FMOD_Channel_GetPosition(channel, &ms, FMOD_TIMEUNIT_SENTENCE_MS);

                    ms += 10000;

                    FMOD_Channel_SetPosition(channel, ms, FMOD_TIMEUNIT_SENTENCE_MS);
                    break;
                }

                case 'n' :
                {
                    FMOD_Channel_GetPosition(channel, &currenttrack, FMOD_TIMEUNIT_SENTENCE_SUBSOUND);

                    currenttrack++;
                    if (currenttrack >= numtracks)
                    {
                        currenttrack = 0;
                    }

                    FMOD_Channel_SetPosition(channel, currenttrack, FMOD_TIMEUNIT_SENTENCE_SUBSOUND);
                    break;
                }
            }
        }

        FMOD_System_Update(system);

        if (channel)
        {
            unsigned int ms;
            unsigned int lenms;
            FMOD_BOOL    playing;
            FMOD_BOOL    paused;
            int          busy;

            result = FMOD_Channel_GetPaused(channel, &paused);
            ERRCHECK(result);
            result = FMOD_Channel_IsPlaying(channel, &playing);
            ERRCHECK(result);
            result = FMOD_Channel_GetPosition(channel, &ms, FMOD_TIMEUNIT_SENTENCE_MS);
            ERRCHECK(result);
            result = FMOD_Sound_GetLength(cdsound, &lenms, FMOD_TIMEUNIT_SENTENCE_MS);
            ERRCHECK(result);

            result = FMOD_File_GetDiskBusy(&busy);
            ERRCHECK(result);

            printf("Track %d/%d : %02d:%02d:%02d/%02d:%02d:%02d : %s (%s)\r", currenttrack + 1, numtracks, ms / 1000 / 60, ms / 1000 % 60, ms / 10 % 100, lenms / 1000 / 60, lenms / 1000 % 60, lenms / 10 % 100, paused ? "Paused " : playing ? "Playing" : "Stopped", busy ? "*" : " ");
        }

        Sleep(50);

    } while (key != 27);

    printf("\n");

    /*
        Shut down
    */
    result = FMOD_Sound_Release(cdsound);
    ERRCHECK(result);
    result = FMOD_System_Close(system);
    ERRCHECK(result);
    result = FMOD_System_Release(system);
    ERRCHECK(result);

    return 0;
}
Пример #30
0
 bool sound::paused()
 {
     FMOD_BOOL ret;
     FMOD_Channel_GetPaused(_chan, &ret);
     return ret;
 }