Giter Site home page Giter Site logo

Comments (6)

sbooth avatar sbooth commented on May 20, 2024

You don't need to register the decoder subclasses- they are registered automatically at static initialization time.

I see your file is located in the Containers directory. Is this a sandboxed app? Perhaps powerboxd is denying access?

from sfbaudioengine.

pzs7602 avatar pzs7602 commented on May 20, 2024

modify AudioPlayer.cpp as follows:

bool SFB::Audio::Player::Play(CFURLRef url)
{
    if(nullptr == url)
        return false;

//  auto decoder = Decoder::CreateForURL(url);
    // modify above line to:
    SFB::CFString extension = CFURLCopyPathExtension(url);
    Decoder::unique_ptr decoder;
    if(kCFCompareEqualTo == CFStringCompare(extension, CFSTR("flac"), kCFCompareCaseInsensitive)){
        decoder = FLACDecoder::CreateDecoder(InputSource::CreateForURL(url));
    }
    else if(kCFCompareEqualTo == CFStringCompare(extension, CFSTR("ape"), kCFCompareCaseInsensitive)){
        decoder = MonkeysAudioDecoder::CreateDecoder(InputSource::CreateForURL(url));
    }
    else if(kCFCompareEqualTo == CFStringCompare(extension, CFSTR("tta"), kCFCompareCaseInsensitive)){
        decoder = TrueAudioDecoder::CreateDecoder(InputSource::CreateForURL(url));
    }
    else if(kCFCompareEqualTo == CFStringCompare(extension, CFSTR("ogg"), kCFCompareCaseInsensitive)){
        decoder = OggVorbisDecoder::CreateDecoder(InputSource::CreateForURL(url));
    }
    else if(kCFCompareEqualTo == CFStringCompare(extension, CFSTR("wv"), kCFCompareCaseInsensitive)){
        decoder = WavPackDecoder::CreateDecoder(InputSource::CreateForURL(url));
    }
    else if(kCFCompareEqualTo == CFStringCompare(extension, CFSTR("aiff"), kCFCompareCaseInsensitive)){
        LOGGER_DEBUG("org.sbooth.AudioEngine.Player", "create sndfile decoder");
        decoder = LibsndfileDecoder::CreateDecoder(InputSource::CreateForURL(url));
    }
    else{
        decoder = Decoder::CreateForURL(url);
    }
    return Play(decoder);
}

then the audio file(flac/ape/wavpack/...) can be played. don't know why.

from sfbaudioengine.

sbooth avatar sbooth commented on May 20, 2024

If you step through Decoder::CreateURL() can you determine where the failure occurs?

from sfbaudioengine.

pzs7602 avatar pzs7602 commented on May 20, 2024

Still can't determine where the failure occurs, the decoder returned by original code is not NULL.
2015-05-07 10 35 18

BTW, how to set the volume of the audio player?
thanks.

from sfbaudioengine.

sbooth avatar sbooth commented on May 20, 2024

Setting the player volume is slightly clunky. If you're using the core audio output:

auto& output = dynamic_cast<SFB::Audio::CoreAudioOutput&>player->GetOutput();
output.SetVolume(0.8);

Obviously this is C++ so to do this from Swift you would need to add some code to your AudioPlayerWrapper class.

from sfbaudioengine.

sbooth avatar sbooth commented on May 20, 2024

Is this still a problem? I'd like to close this issue if not.

from sfbaudioengine.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.