Advertisement
ScratchMonkey

SDL FLAC experiment

Apr 18th, 2024
898
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.87 KB | Source Code | 0 0
  1. // invoked from SDL audio thread to fill buffer with more samples
  2. size_t Flac::getData(size_t len, void *buf)
  3. {
  4.    bool success = true;
  5.    while (success && !enoughSamples() && moreDataAvailable())
  6.       success = decoder->process_single()
  7.    // Now copy data from Flac buffers to buf, keeping any overflow for
  8.    // next time. If we got less than requested, return the truncated
  9.    // count.
  10. }
  11.  
  12. ::FLAC__StreamDecoderWriteStatus FlacDecoder::write_callback(const ::FLAC__Frame *frame, const FLAC__int32 *const buffer[])
  13. {
  14.    // copy the decoded data into our Flac buffer for its SDL callback
  15.    // to fetch and update the count and moreDataAvailable flag
  16.  
  17.    
  18.    return ::FLAC__StreamDecoderWriteStatus();
  19. }
  20.  
  21. // cache the Flac object here for use by the callback
  22.  
  23. FlacDecoder(TagLib::String path, Flac& flac_) : FLAC::Decoder::File(), flac(flac_), m_path(path) { }
Tags: FLAC SDL
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement