I am trying to play an Ogg Vorbis file in RemoteIO, I use the following code for gaining the PCM samples from the vorbis:I am trying to play an Ogg Vorbis file in RemoteIO, I use the following code for gaining the PCM samples from the vorbis:
ssize_t r = ov_read(ds->vf,pcm->buf,sizeof(pcm->buf),SYSTEM_ENDIAN,2,1,NULL);
According to the docs on ov_read this puts samples in the buffer with a little endian format, 16 bit signed samples. This works fine, and I have been feeding the RemoteIO this data, however the sound is heavily distorted, although recognisable and playing in the right time. This is the format I am using:
AudioStreamBasicDescription streamFormat;
streamFormat.mSampleRate = 44100.0;
streamFormat.mFormatID = kAudioFormatLinearPCM;
streamFormat.mFormatFlags = kAudioFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked;
streamFormat.mBytesPerPacket = 4;
streamFormat.mFramesPerPacket = 1;
streamFormat.mBytesPerFrame = 4;
streamFormat.mChannelsPerFrame = 2;
streamFormat.mBitsPerChannel = 16;