0
0

I’d like to calculate some data in every second while the song is playing. But it doesn’t work, this is part of my codes.
while(1)
{
channel->getPosition(&length1,FMOD_TIMEUNIT_MS);

        if(length1==5000)
            std::cout<<length1<<"\r";
    }

Interesting, it worked well if i wiped the condition
while(1)
{
channel->getPosition(&length1,FMOD_TIMEUNIT_MS);
std::cout<<length1<<"\r";
}

Is it a FMOD’s bug or I missed something? furthermore,how many samples are proccessed in one loop? can i process the data by samples rather than time? im using vs.net2003

  • You must to post comments
0
0

You’re assuming every time your loop iterates, that the position goes up by 1? That is not going to happen, it will jump up depending on how long it took between calls to getPosition, and it may be even coarser than that because fmod’s mixer is updated in chunks of 256 samples at a time.

You should use greater than/less than comparisons rather than ==.

  • You must to post comments
0
0

thx for ur reply. One more question, is there any method can implement reading mp3 file one sample by one sample?

  • You must to post comments
0
0

Yes you could look at FMOD_OPENONLY then Sound::readData

  • You must to post comments
0
0

it’s nice, i love it, thanks for your help. Happy Christmas.

  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.