I do the following to init flac: encoder = FLAC__stream_encoder_new(); e = FLAC__stream_encoder_set_do_mid_side_stereo (encoder, numChannels == 2); e = FLAC__stream_encoder_set_loose_mid_side_stereo (encoder, numChannels == 2); e = FLAC__stream_encoder_set_channels (encoder, numChannels); e = FLAC__stream_encoder_set_bits_per_sample (encoder, jmin (24, bitsPerSample)); e = FLAC__stream_encoder_set_sample_rate (encoder, sampleRate); e = FLAC__stream_encoder_set_blocksize (encoder, 2048); e = FLAC__stream_encoder_set_do_escape_coding (encoder, true); e = FLAC__stream_encoder_set_write_callback (encoder, &encodeWriteCallback); e = FLAC__stream_encoder_set_metadata_callback (encoder, &encodeMetadataCallback); e = FLAC__stream_encoder_set_client_data (encoder, (void*)this); And everything goes ok. But then when I go: bool ok = (FLAC__stream_encoder_init (encoder) == FLAC__STREAM_ENCODER_OK); It fails if sampleRate is 88200, but ti works if the sampleRate is 44100. Any idea what I'm doing wrong? I'm not sure what version of flac I am using, it is fairly old, but I don't see any version numbers in the headers. Is this a known bug that has been fixed? R
--- Roland Rabien <Roland.Rabien@mackie.com> wrote:> I do the following to init flac: > > encoder = FLAC__stream_encoder_new(); > > e = FLAC__stream_encoder_set_do_mid_side_stereo (encoder, > numChannels == 2); > e = FLAC__stream_encoder_set_loose_mid_side_stereo (encoder, > numChannels == 2); > e = FLAC__stream_encoder_set_channels (encoder, numChannels); > e = FLAC__stream_encoder_set_bits_per_sample (encoder, jmin > (24, > bitsPerSample)); > e = FLAC__stream_encoder_set_sample_rate (encoder, > sampleRate); > e = FLAC__stream_encoder_set_blocksize (encoder, 2048); > e = FLAC__stream_encoder_set_do_escape_coding (encoder, > true); > e = FLAC__stream_encoder_set_write_callback (encoder, > &encodeWriteCallback); > e = FLAC__stream_encoder_set_metadata_callback (encoder, > &encodeMetadataCallback); > e = FLAC__stream_encoder_set_client_data (encoder, > (void*)this); > > And everything goes ok. > > But then when I go: > > bool ok = (FLAC__stream_encoder_init (encoder) => FLAC__STREAM_ENCODER_OK); > > It fails if sampleRate is 88200, but ti works if the sampleRate is > 44100. > > Any idea what I'm doing wrong? > > I'm not sure what version of flac I am using, it is fairly old, but I > don't see any version numbers in the headers. Is this a known bug > that has been fixed?88200Hz is not in the FLAC subset http://flac.sourceforge.net/format.html#subset so first you need to turn off subset checking http://flac.sourceforge.net/api/group__flac__stream__encoder.html#ga16 Josh ____________________________________________________________________________________ Need Mail bonding? Go to the Yahoo! Mail Q&A for great tips from Yahoo! Answers users. http://answers.yahoo.com/dir/?link=list&sid=396546091
Thanks guys, I got it working. Josh Coalson wrote:> --- Roland Rabien <Roland.Rabien@mackie.com> wrote: > >> I do the following to init flac: >> >> encoder = FLAC__stream_encoder_new(); >> >> e = FLAC__stream_encoder_set_do_mid_side_stereo (encoder, >> numChannels == 2); >> e = FLAC__stream_encoder_set_loose_mid_side_stereo (encoder, >> numChannels == 2); >> e = FLAC__stream_encoder_set_channels (encoder, numChannels); >> e = FLAC__stream_encoder_set_bits_per_sample (encoder, jmin >> (24, >> bitsPerSample)); >> e = FLAC__stream_encoder_set_sample_rate (encoder, >> sampleRate); >> e = FLAC__stream_encoder_set_blocksize (encoder, 2048); >> e = FLAC__stream_encoder_set_do_escape_coding (encoder, >> true); >> e = FLAC__stream_encoder_set_write_callback (encoder, >> &encodeWriteCallback); >> e = FLAC__stream_encoder_set_metadata_callback (encoder, >> &encodeMetadataCallback); >> e = FLAC__stream_encoder_set_client_data (encoder, >> (void*)this); >> >> And everything goes ok. >> >> But then when I go: >> >> bool ok = (FLAC__stream_encoder_init (encoder) =>> FLAC__STREAM_ENCODER_OK); >> >> It fails if sampleRate is 88200, but ti works if the sampleRate is >> 44100. >> >> Any idea what I'm doing wrong? >> >> I'm not sure what version of flac I am using, it is fairly old, but I >> don't see any version numbers in the headers. Is this a known bug >> that has been fixed? >> > > 88200Hz is not in the FLAC subset > http://flac.sourceforge.net/format.html#subset > > so first you need to turn off subset checking > http://flac.sourceforge.net/api/group__flac__stream__encoder.html#ga16 > > Josh > > > > > > ____________________________________________________________________________________ > Need Mail bonding? > Go to the Yahoo! Mail Q&A for great tips from Yahoo! Answers users. > http://answers.yahoo.com/dir/?link=list&sid=396546091 > > > >