0
0

Hello all.

I have a problem with reverse playback of sound file.

Here is my code:

[code:196zop47]
result = system->init(32, FMOD_INIT_NORMAL, NULL);
ERRCHECK(result);

[[NSString stringWithFormat:@"%@/drumloop.wav", [[NSBundle mainBundle] resourcePath]] getCString:buffer maxLength:200 encoding:NSASCIIStringEncoding];
result = system->createSound(buffer, FMOD_SOFTWARE, NULL, &sound);
ERRCHECK(result);


result = system->playSound(FMOD_CHANNEL_FREE, sound, true, &channel);
ERRCHECK(result);   

float channelFrequency;
result = channel->getFrequency(&channelFrequency);
ERRCHECK(result);
NSLog(@"Channel frequency: %f", channelFrequency);

// channel->setFrequency(-channelFrequency);

channel->setPaused(false);

[/code:196zop47]

Commented line is the source of my problems. Positive values of channel frequency works as expected but any negative number causes immediate stop of playback (channel callback is called with FMOD_CHANNEL_CALLBACKTYPE_END).

I’ve tried to get min & max possible values with

[code:196zop47] int driversNum;
result = system->getNumDrivers(&driversNum);
ERRCHECK(result);

int minFreq, maxFreq;
for(int i = 0; i < driversNum; i++) {
    result = system->getDriverCaps(i, 0, &minFreq, &maxFreq, 0);
    ERRCHECK(result);
    NSLog(@"Frequency range for %2d is %d...%d", i, minFreq, maxFreq);
}

[/code:196zop47]

but all I got is

"Frequency range for 0 is 0…0"

Thanks in advance.

P.S iPhone SDK 3.0, FMOD Ex 00042607

  • You must to post comments
0
0

Hello,

Perhaps you should turn on looping, or alternatively set the position of the audio file to the end of the file. If you have looping off and you are at the beginning of the file, then you probably won’t hear anything.

  • George
  • You must to post comments
0
0

Thank you George! Channel::setPosition did the trick. I should have figured that out by myself 😳 .

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.