0
0

//
SoundSystem Init…
Num of Drivers: 0…
SetOutput: Dsound…
SetDriver: Primary Sound Driver (0)…
SetMixer: Autodetect…
SetHwnd…
SetSpeakerMode: Stereo…
SoundSystem enabled! (Made for v3.62: Loaded FMOD v3.62)
//

If I load
(mode == FSOUND_LOOP_NORMAL | FSOUND_2D)
even tried FSOUND_HW2D

FSOUND_Stream_OpenFile(FileName, mode, 0);

loads & plays ok
But.. I need to have it loop part of the mp3..

FSOUND_Stream_SetLoopPoints(CurChan->STREAM, U32(30000), FSOUND_Stream_GetLength(CurChan->STREAM));

It’ll play up to about 30000 and re-start … and if I setlooppoints while its playing it’ll crash:\

I’m on win98 SE.

  • You must to post comments
0
0

Is 30000 supposed to be a millisecond position? SetLoopPoints expects sample offsets, not time offsets. Another problem with your code I can see, too, is the GetLength. According to the documentation, GetLength returns the length of a stream in bytes, not samples. This could be the real cause of the problem.

[b:ywn2w2dk]@Brett[/b:ywn2w2dk]
While I’m on this subject, I couldn’t help but notice an API inconsistency while attempting to solve his problem. Why is it that, in the documentation for FSOUND_Stream_GetLength, you state “position functions for streams work in bytes, not samples.” (and this is definitely 99% true from what I can see), yet FSOUND_Stream_SetLoopPoints expects sample offsets? Word from the wise: stick to your own rules when designing an API.

  • You must to post comments
0
0

Hey, calm down, okay? I’m just pointing out that in the documentation, it says “Position functions for streams work in bytes not samples.”–as if that were true of all stream position functions, which it isn’t. SetLoopPoints counts as a “position function” categorically, and it’s one of a few exceptions to the rule. Basically, I’m letting you know to just be careful what you say in documentation, especially if you don’t want obsessive perfectionists such as myself to correct you all the time.

  • You must to post comments
0
0

This is the max range fmod will let me set the loop (for this mp3)
FSOUND_Stream_SetLoopPoints(CurChan->STREAM, 0, 3635338)

And that isn’t playing the whole song.. (if I set the number any higher I get an error from fmod)

Edit: This is using v3.63

  • You must to post comments
0
0

The mp3 length is 1:22

_GetLength = (1319079)
_GetLengthMS = (82434)

  • You must to post comments
0
0

I give up , i’ll just create 2 files and have one loop after the other plays one time ๐Ÿ˜

  • You must to post comments
0
0

I’m not much of a sound programmer, sorry :) thats why I’m using this.

How do I get the sample rate?:o

  • You must to post comments
0
0

๐Ÿ˜† Thanks!

hehe, I’ll need to get a book or something about all this sound stuff ๐Ÿ˜›

  • You must to post comments
0
0

Hrm… odd… the stream will play.. then re-start (_GetPostion shows it starting over) But the Time still shows.. nows its getting all weird on me Doh:o

Heres my ss (SoundSystem.cc)

[code:kq3zro07]

include "console/console.h"

include "console/consoleInternal.h"

include "console/consoleTypes.h"

include "platform/platform.h"

include "platformWin32/platformWin32.h"

include "rm/audio/fmod/SoundSystem.h"

/*
typedef signed char S8; ///< Compiler independent Signed Char
typedef unsigned char U8; ///< Compiler independent Unsigned Char

typedef signed short S16; ///< Compiler independent Signed 16-bit short
typedef unsigned short U16; ///< Compiler independent Unsigned 16-bit short

typedef signed int S32; ///< Compiler independent Signed 32-bit integer
typedef unsigned int U32; ///< Compiler independent Unsigned 32-bit integer

typedef float F32; ///< Compiler independent 32-bit float
typedef double F64; ///< Compiler independent 64-bit float
*/

// global inst
CSoundSystem *gSoundSystem = NULL;

// SoundSystem macros

define ssErrorCheck() if(FSOUND_GetError() != FMOD_ERR_NONE) Con::errorf("SoundSystem Error: %s\n", FMOD_ErrorString(FSOUND_GetError()));

define ssIsCreated() bool(gSoundSystem != NULL)

// AssertFatal(false, "error!");

// non-class helper functions
static U32 ssStringToValue(const char *name) {

AssertFatal(name, &quot;ssStringToValue: bad param&quot;);

static struct {
char* mName;
U32 mU32;
} table[] = {
    //-----------------------------------------------------------------------------------------------------------------
    //  &quot;name&quot;                        ENUM
    //----------------------------------------------------------------------------------------------
    {  &quot;FSOUND_LOOP_OFF&quot;,            FSOUND_LOOP_OFF },
    {  &quot;FSOUND_LOOP_NORMAL&quot;,     FSOUND_LOOP_NORMAL  },
    {  &quot;FSOUND_LOOP_BIDI&quot;,           FSOUND_LOOP_BIDI    },
    {  &quot;FSOUND_HW3D&quot;,                FSOUND_HW3D },
    {  &quot;FSOUND_2D&quot;,                  FSOUND_2D   },
    {  &quot;FSOUND_STREAMABLE&quot;,          FSOUND_STREAMABLE   },
    {  &quot;FSOUND_LOADMEMORY&quot;,          FSOUND_LOADMEMORY   },
    {  &quot;FSOUND_LOADRAW&quot;,         FSOUND_LOADRAW  },
    {  &quot;FSOUND_MPEGACCURATE&quot;,        FSOUND_MPEGACCURATE }
};


for(U32 i = 0; i &lt; (sizeof(table) / sizeof(table[0])); i++) {

    if(dStricmp(table[i].mName, name) == 0)
        return (table[i].mU32);
}

return U32(-1);

}

bool ssCheckIsValid() {

if(!ssIsCreated())
    Con::warnf(&quot;SoundSystem has not been init!&quot;);
else if(!gSoundSystem-&gt;SystemIsInit)
    Con::warnf(&quot;SoundSystem is currently disabled!&quot;);
else
    return true;
return false;

}

//===============================================================================================================
// Console Functions

ConsoleFunction(ssInitDriver, bool, 1, 1, "ssInitDriver()")
{
CSoundSystem::Init();
return gSoundSystem->SystemIsInit;
}

ConsoleFunction(ssShutdownDriver, bool, 1, 1, "ssShutdownDriver()")
{
if(!ssIsCreated())
return false;

CSoundSystem::ShutDown();
return !gSoundSystem-&gt;SystemIsInit;

}

/*
FSOUND_LOOP_OFF FSOUND_LOOP_NORMAL FSOUND_LOOP_BIDI FSOUND_HW2D FSOUND_HW3D
FSOUND_2D FSOUND_STREAMABLE FSOUND_LOADMEMORY FSOUND_LOADRAW FSOUND_MPEGACCURATE
*/
// ssSetLoopPoints(300000, 1319079);
// ssSetLoopPoints(0, 3635338);
// ssSetLoopPoints(300000, 3635338);
// ssSetLoopPoints(600000, 3635338);
//3635338
//3635339.4
//ssSetLoopPoints(0,3635339);
ConsoleFunction(ssCreateSource, int, 2, 11, "ssCreateSource(filename, [modes ...])")
{
//char *filename;
if(!ssCheckIsValid())
return -1;

if(dStrlen(argv[1]) &lt;= 2) {
    Con::warnf(&quot;ssCreateSource() invalid file name.&quot;);
    return -1;
}

U32 chanMode = FSOUND_MPEGACCURATE | FSOUND_LOOP_NORMAL | FSOUND_2D; // FSOUND_HW2D


if(argc &gt;= 3) {

    U32 Value;

    chanMode = ssStringToValue(argv[3]);
    if(chanMode == -1) {
        Con::errorf(&quot;ssCreateSource(): invalid mode arg: %s&quot;, argv[3]);
        return -1;
    }

    for(int i = 4; i &lt; argc; i++) {
        Value = ssStringToValue(argv[i]);
        if(Value == -1) {
            Con::errorf(&quot;ssCreateSource(): invalid mode arg: %s&quot;, argv[i]);
            return -1;
        }
        chanMode |= Value;
    }
}

// try to load sound file
return gSoundSystem-&gt;Load((char *)argv[1], chanMode);

}

ConsoleFunction(ssDeleteSourcei, void, 2, 3, "ssDeleteSource([id])")
{
if(!ssCheckIsValid())
return;

if(argc == 2)
    gSoundSystem-&gt;unload(dAtoi(argv[1]));
else {
    if(gSoundSystem-&gt;CurChan != NULL)
        gSoundSystem-&gt;unload(gSoundSystem-&gt;CurChan-&gt;getID());
}

}

ConsoleFunction(ssSetCurrent, void, 2, 2, "ssSetCurrent(id)")
{
argc;

if(!ssCheckIsValid())
    return;

gSoundSystem-&gt;SetCurrentChannel(dAtoi(argv[1]));

}

ConsoleFunction(ssPlay, void, 1, 1, "ssPlay()")
{
argc;

if(!ssCheckIsValid())
    return;

gSoundSystem-&gt;Play();

}

ConsoleFunction(ssPause, void, 1, 1, "ssPause()")
{
argc;

if(!ssCheckIsValid())
    return;

gSoundSystem-&gt;Pause();

}

ConsoleFunction(ssStop, void, 1, 1, "ssStop()")
{
argc;

if(!ssCheckIsValid())
    return;

gSoundSystem-&gt;Stop();

}

ConsoleFunction(ssSetLoopPoints, void, 3, 3, "ssSetLoopPoints(StartPoint, EndPoint)")
{
argc;

if(!ssCheckIsValid())
    return;

gSoundSystem-&gt;SetLoopPoints(dAtoi(argv[1]), dAtoi(argv[2]));

}

ConsoleFunction(ssEchoPos, void, 1, 1, "ssEchoPos()")
{
argc;

if(!ssCheckIsValid())
    return;

if(gSoundSystem-&gt;validCurChan()) {

    Con::printf(&quot;pos: [%d / %d ] - cpu %5.02f%%&quot;, FSOUND_Stream_GetPosition(gSoundSystem-&gt;CurChan-&gt;STREAM), FSOUND_Stream_GetLength(gSoundSystem-&gt;CurChan-&gt;STREAM), FSOUND_GetCPUUsage());
}

}
ConsoleFunction(ssEcho, void, 1, 1, "ssEcho()")
{
argc;

if(!ssCheckIsValid())
    return;

if(gSoundSystem-&gt;validCurChan()) {

    Con::printf(&quot;_GetTime(%d)\n_GetLength(%d)\nn_GetLengthMS(%d)\n&quot;,

        FSOUND_Stream_GetTime(gSoundSystem-&gt;CurChan-&gt;STREAM), FSOUND_Stream_GetLength(gSoundSystem-&gt;CurChan-&gt;STREAM), FSOUND_Stream_GetLengthMs(gSoundSystem-&gt;CurChan-&gt;STREAM));

// Con::printf("pos: [%d / %d ] – cpu %5.02f%%", FSOUND_Stream_GetPosition(gSoundSystem->CurChan->STREAM), FSOUND_Stream_GetLength(gSoundSystem->CurChan->STREAM), FSOUND_GetCPUUsage());
}
}

char *ssGetStreamInfo() {
char *text = Con::getArgBuffer(128);
if(ssCheckIsValid()) {
if(gSoundSystem->validCurChan()) {

        dSprintf(text, 128, &quot;pos %6d/%6d time %02d:%02d/%02d:%02d cpu %5.02f%%&quot;, FSOUND_Stream_GetPosition(gSoundSystem-&gt;CurChan-&gt;STREAM),
                                                                    FSOUND_Stream_GetLength(gSoundSystem-&gt;CurChan-&gt;STREAM),
                                                                    FSOUND_Stream_GetTime(gSoundSystem-&gt;CurChan-&gt;STREAM) / 1000 / 60,
                                                                    FSOUND_Stream_GetTime(gSoundSystem-&gt;CurChan-&gt;STREAM) / 1000 % 60,
                                                                    FSOUND_Stream_GetLengthMs(gSoundSystem-&gt;CurChan-&gt;STREAM) / 1000 / 60,
                                                                    FSOUND_Stream_GetLengthMs(gSoundSystem-&gt;CurChan-&gt;STREAM) / 1000 % 60,
                                                                    FSOUND_GetCPUUsage());

        return text;
    }
}
dSprintf(text, 128, &quot;NA&quot;);
return text;

}

//===============================================================================================================

void CSoundSystem::Init() {

int numDrv, i;
char *DriverName;

if(gSoundSystem != NULL) {
    if(gSoundSystem-&gt;SystemIsInit) {
        Con::warnf(&quot;CSoundSystem::Init(): gSoundSystem already init&quot;);
        return;
    }

    // just delete it..
    //Con::warnf(&quot;CSoundSystem::Init(): gSoundSystem != NULL&quot;);
    //delete [] gSoundSystem;
}
else
    gSoundSystem = new CSoundSystem;

Con::printf(&quot;\n  SoundSystem Init...&quot;);

/* if(gSoundSystem->mInstance == NULL)
gSoundSystem->mInstance = new FMOD_INSTANCE;

gSoundSystem-&gt;mInstance = FMOD_CreateInstance(&quot;fmod.dll&quot;);

if(gSoundSystem-&gt;mInstance == NULL) {

    gSoundSystem-&gt;SystemIsInit = false;
    Con::printf(&quot;\n FMOD_CreateInstance() failed to load fmod.dll!\n   SoundSystem disabled!\n&quot;);
    return;
}

*/
gSoundSystem->CurChan = NULL;

numDrv = FSOUND_GetNumDrivers();

Con::printf(&quot;  Num of Drivers: %i...&quot;, numDrv);

for(i = 0; i &lt; numDrv; i++) {
    Con::printf(&quot;   DriverName: %s (%i)...&quot;, FSOUND_GetDriverName(i), i);
}

Con::printf(&quot;  SetOutput: Dsound...&quot;);
FSOUND_SetOutput(FSOUND_OUTPUT_DSOUND);
ssErrorCheck();

Con::printf(&quot;  SetDriver: %s (%i)...&quot;, FSOUND_GetDriverName(numDrv), numDrv);
FSOUND_SetDriver(numDrv);
ssErrorCheck();

Con::printf(&quot;  SetMixer: Autodetect...&quot;); //.........
FSOUND_SetMixer(FSOUND_MIXER_QUALITY_AUTODETECT);
ssErrorCheck();

// FSOUND_SetBufferSize(int len_ms);
// FSOUND_SetBufferSize(1000);
// FSOUND_Stream_SetBufferSize(1000);

Con::printf(&quot;  SetHwnd...&quot;);
FSOUND_SetHWND(winState.appWindow);
ssErrorCheck();

// FSOUND_SetMinHardwareChannels(int min);
// FSOUND_SetMaxHardwareChannels(int max);

if(!FSOUND_Init(22050, 32, FSOUND_INIT_GLOBALFOCUS)) {
    ssErrorCheck();
    Con::printf(&quot;\n FSOUND_Init failed!\n  SoundSystem disabled!\n&quot;);
    gSoundSystem-&gt;SystemIsInit = false;
    return;
}

gSoundSystem-&gt;SoundChannels.free();

gSoundSystem-&gt;SystemIsInit = true;

Con::printf(&quot;  SetSpeakerMode: Stereo...&quot;);
FSOUND_SetSpeakerMode(FSOUND_SPEAKERMODE_STEREO);
ssErrorCheck();

FSOUND_SetSFXMasterVolume(200);

//if(FSOUND_GetError() != FMOD_ERR_NONE)
    Con::printf(&quot;  SoundSystem enabled! (Made for v%.2lf: Loaded FMOD v%.2lf)\n\n&quot;, (float)FMOD_VERSION, (float)FSOUND_GetVersion());

//sprintf(s, "Channels %03d – CPU %5.02f%% ", FSOUND_GetChannelsPlaying(), FSOUND_GetCPUUsage());
}

void CSoundSystem::ShutDown() {

if(gSoundSystem-&gt;SystemIsInit) {

    FMOD_SoundChannel *SndChan = NULL;
    while( bool(SndChan = gSoundSystem-&gt;SoundChannels.next(SndChan)) ) {
        SndChan-&gt;Stop();

// gSoundSystem->unload(SndChan->getID());
}

    gSoundSystem-&gt;SoundChannels.free();

    FSOUND_Close();

    gSoundSystem-&gt;CurChan = NULL;

    gSoundSystem-&gt;SystemIsInit = false;

// FMOD_FreeInstance(gSoundSystem->mInstance);
}
}

int CSoundSystem::Load(char *FileName, unsigned int mode) {

if(!SystemIsInit) {
    Con::errorf(&quot;CSoundSystem::Load(): SoundSystem is disabled.&quot;);
    return -1;
}

Con::printf(&quot;db: CSoundSystem::Load(): %s&quot;, FileName);

FMOD_SoundChannel *SndChan = new FMOD_SoundChannel;
int newID;

SndChan-&gt;setName(FileName);

newID = GetFreeID();
SndChan-&gt;setID(newID);

SndChan-&gt;MODULE = NULL;
SndChan-&gt;STREAM = NULL;
SndChan-&gt;setFlag(SS_CHAN_INVALID);

// try to load as Module
SndChan-&gt;MODULE = FMUSIC_LoadSong(FileName); // MOD,S3M,XM,IT,MIDI...

if(SndChan-&gt;MODULE == NULL) {

    // not a module.. load as stream
    SndChan-&gt;STREAM = FSOUND_Stream_OpenFile(FileName, mode, 0); // WAV,MP2,MP3,WMA,MPEG...
    SndChan-&gt;setFlag(SS_CHAN_STREAM);
    Con::printf(&quot;db: loaded stream&quot;);
}
else {
    SndChan-&gt;setFlag(SS_CHAN_MODULE);
    Con::printf(&quot;db: loaded module&quot;);
}

// failed to load this file?
if(SndChan-&gt;isFlag(SS_CHAN_INVALID)) {
    Con::errorf(&quot;CSoundSystem::Load(): Failed to load file %s&quot;, FileName);

// delete [] SndChan;
return -1;
}

if(SndChan-&gt;MODULE != NULL) {

    if (FMUSIC_GetType(SndChan-&gt;MODULE) != FMUSIC_TYPE_IT)       // IT has its own master volume setting
        FMUSIC_SetMasterVolume(SndChan-&gt;MODULE, 128);
    if (FMUSIC_GetType(SndChan-&gt;MODULE) == FMUSIC_TYPE_MOD || FMUSIC_GetType(SndChan-&gt;MODULE) == FMUSIC_TYPE_S3M)
        FMUSIC_SetPanSeperation(SndChan-&gt;MODULE, 0.85f); // 15% crossover
}

SoundChannels.link(*SndChan);

return newID;

}

void CSoundSystem::unload(int iChanNum) {

FMOD_SoundChannel *SndChan = GetChannel(iChanNum);
if(SndChan != NULL) {

    if(SndChan-&gt;isFlag(SS_CHAN_MODULE))
        FMUSIC_FreeSong(SndChan-&gt;MODULE);
    else if(SndChan-&gt;isFlag(SS_CHAN_STREAM))
        FSOUND_Stream_Close(SndChan-&gt;STREAM);

    SndChan-&gt;setFlag(SS_CHAN_INVALID);

    SoundChannels.unlink(SndChan);
}
else
    Con::warnf(&quot;CSoundSystem::unload(): Invalid Channel (%i)&quot;, iChanNum);

}

int CSoundSystem::GetFreeID() {

FMOD_SoundChannel *SndChan = NULL;

int id = 0;

// while(1) {

// bool foundNewID = true;

    while( bool(SndChan = SoundChannels.next(SndChan)) ) {

        if(SndChan-&gt;getID() == id) {
            id++;

// foundNewID = false;
SndChan = NULL;
// break;
}
}

// if(foundNewID)
// break;
// }

return id;

}

FMOD_SoundChannel *CSoundSystem::GetChannel(int iChanNum) {

FMOD_SoundChannel *SndChan = NULL;
while( bool(SndChan = SoundChannels.next(SndChan)) ) {

    if(SndChan-&gt;getID() == iChanNum)
        return SndChan;
}

return NULL;

}

void CSoundSystem::SetCurrentChannel(FMOD_SoundChannel *SndChan) {

CurChan = SndChan;

}

void CSoundSystem::SetCurrentChannel(int iChanNum) {

FMOD_SoundChannel *SndChan = GetChannel(iChanNum);
if(SndChan != NULL) {

    if(SndChan-&gt;isFlag(SS_CHAN_INVALID))
        Con::errorf(&quot;CSoundSystem::SetCurrentChannel(): Sound Channel %i is invalid&quot;, iChanNum);
    else
        SetCurrentChannel(SndChan);
}
else
    Con::errorf(&quot;CSoundSystem::SetCurrentChannel(): Failed to find Sound Channel %i&quot;, iChanNum);

}

bool CSoundSystem::validCurChan() {
return bool( (CurChan != NULL) && !CurChan->isFlag(SS_CHAN_INVALID) );
}

void CSoundSystem::advanceTime(F32 dt) {

FMOD_SoundChannel *SndChan = NULL;
while( bool(SndChan = SoundChannels.next(SndChan)) ) {
    SndChan-&gt;advanceTime(dt);
}

}

void CSoundSystem::Play() {

if(validCurChan())
    CurChan-&gt;Play();

}

void CSoundSystem::Pause() {

if(validCurChan())
    CurChan-&gt;Pause();

}

void CSoundSystem::unPause() {

if(validCurChan())
    CurChan-&gt;unPause();

}

void CSoundSystem::Stop() {

if(validCurChan())
    CurChan-&gt;Stop();

}

void CSoundSystem::SetLoopPoints(U32 StartPoint, U32 EndPoint) {

if(validCurChan()) {

    if(CurChan-&gt;isFlag(SS_CHAN_STREAM)) {

        // get the end position
        if(EndPoint == -1)
            EndPoint = FSOUND_Stream_GetLength(CurChan-&gt;STREAM);

        if(StartPoint &gt;= EndPoint) {

            if(StartPoint == 0 &amp;&amp; EndPoint == 0) {  // re-setting loop points
                if(FSOUND_Stream_SetLoopPoints(CurChan-&gt;STREAM, U32(0), FSOUND_Stream_GetLength(CurChan-&gt;STREAM)) != S8(1)) {
                    Con::warnf(&quot;SetLoopPoints(): Failed to start Loop Points (%d %d)&quot;, StartPoint, EndPoint);
                    ssErrorCheck();
                }
            }
            else
                Con::warnf(&quot;CSoundSystem::SetLoopPoints(): EndPoint can't be greater then, or equal to StartPoint!&quot;);
        }
        else {

            if(FSOUND_Stream_SetLoopPoints(CurChan-&gt;STREAM, StartPoint, EndPoint) != S8(1)) {
                Con::warnf(&quot;SetLoopPoints(): Failed to start Loop Points (%d %d)&quot;, StartPoint, EndPoint);
                ssErrorCheck();
            }
        }
    }
    else
        Con::warnf(&quot;CSoundSystem::SetLoopPoints(): Current Channel (%s - %i) isn't a stream.&quot;, CurChan-&gt;getName(), CurChan-&gt;getID());
}

}

//===============================================================================================================
// FMOD_SoundChannel

void FMOD_SoundChannel::Play() {

if(isFlag(SS_CHAN_PAUSE)) {
    if(isFlag(SS_CHAN_MODULE))
        FMUSIC_SetPaused(MODULE, S8(0));//!FMUSIC_GetPaused(MODULE));
    else if(isFlag(SS_CHAN_STREAM))
        FSOUND_SetPaused(StreamID, S8(0)); //!FSOUND_GetPaused(StreamID));

    addFlag(SS_CHAN_PLAYING);
    delFlag(SS_CHAN_PAUSE);

    Con::printf(&quot;db: unPause&quot;);
}
else {
    if(isFlag(SS_CHAN_MODULE)) {
        FMUSIC_PlaySong(MODULE);
        addFlag(SS_CHAN_PLAYING);
        Con::printf(&quot;db: play Module&quot;);
    }
    else if(isFlag(SS_CHAN_STREAM)) {
        StreamID = FSOUND_Stream_Play(FSOUND_FREE, STREAM);
        addFlag(SS_CHAN_PLAYING);
        FSOUND_SetVolume(StreamID, 128);
        Con::printf(&quot;db: play stream (%i)&quot;, StreamID);
    }
    else
        Con::errorf(&quot;FMOD_SoundChannel::Play(): invalid sound channel&quot;);
}

}

void FMOD_SoundChannel::Pause() {

if(isFlag(SS_CHAN_PLAYING)) {

    if(isFlag(SS_CHAN_MODULE))
        FMUSIC_SetPaused(MODULE, S8(1));//!FMUSIC_GetPaused(MODULE));
    else if(isFlag(SS_CHAN_STREAM))
        FSOUND_SetPaused(StreamID, S8(1));//!FSOUND_GetPaused(StreamID));

    delFlag(SS_CHAN_PLAYING);
    addFlag(SS_CHAN_PAUSE);

    Con::printf(&quot;db: Pause&quot;);
}

}

void FMOD_SoundChannel::unPause() {

if(isFlag(SS_CHAN_PAUSE)) {
    if(isFlag(SS_CHAN_MODULE))
        FMUSIC_SetPaused(MODULE, S8(0));//!FMUSIC_GetPaused(MODULE));
    else if(isFlag(SS_CHAN_STREAM))
        FSOUND_SetPaused(StreamID, S8(0)); //!FSOUND_GetPaused(StreamID));

    addFlag(SS_CHAN_PLAYING);
    delFlag(SS_CHAN_PAUSE);

    Con::printf(&quot;db: unPause&quot;);
}

}

void FMOD_SoundChannel::Stop() {

// if its paused.. we still wanna "stop" it~
// if(isFlag(SS_CHAN_PAUSE)) {
if(isFlag(SS_CHAN_MODULE))
FMUSIC_StopSong(MODULE);
else if(isFlag(SS_CHAN_STREAM)) {
FSOUND_Stream_Stop(STREAM);
FSOUND_Stream_SetPosition(STREAM, 0);
}

    if(isFlag(SS_CHAN_PLAYING))
        delFlag(SS_CHAN_PLAYING);

    if(isFlag(SS_CHAN_PAUSE))
        delFlag(SS_CHAN_PAUSE);

    Con::printf(&quot;db: Stop&quot;);

// }
}

void FMOD_SoundChannel::advanceTime(F32 dt) {

// update effects

}

[/code:kq3zro07]

  • You must to post comments
Showing 8 results
Your Answer

Please first to submit.