0

I have a problem with updateBuffer method when I'm setting pan to right earphone (1.0f). Sound is playing correctly but plot is not updating: **buffer = (float) 0 for every element.

Code is simple:

- (void)audioPlayer:(EZAudioPlayer *)audioPlayer
             playedAudio:(float **)buffer
          withBufferSize:(UInt32)bufferSize
    withNumberOfChannels:(UInt32)numberOfChannels
             inAudioFile:(EZAudioFile *)audioFile {

  __weak typeof(self) weakSelf = self;
  [weakSelf.plot updateBuffer:buffer[0] withBufferSize:bufferSize];
}

its working for left earphone -> pan = -1.0f or both -> 0.0f but not for right one.

Juan Boero
  • 6,281
  • 1
  • 44
  • 62
Lau
  • 1,804
  • 1
  • 23
  • 49
  • from the documentation of EZAudio "The waveform data itself will be an array of float arrays, one for each channel, and the length indicates the total length of each float array." – Juan Boero Jun 13 '16 at 06:45

1 Answers1

1

(float **)buffer is a 2d array and so I am assuming buffer[0] is left channel while buffer[1] is right channel. Try putting in buffer[1] instead.

yun
  • 1,243
  • 11
  • 30