Comments (6)
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.
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.
If you step through Decoder::CreateURL()
can you determine where the failure occurs?
from sfbaudioengine.
Still can't determine where the failure occurs, the decoder returned by original code is not NULL.
BTW, how to set the volume of the audio player?
thanks.
from sfbaudioengine.
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.
Is this still a problem? I'd like to close this issue if not.
from sfbaudioengine.
Related Issues (20)
- Can't run in physical device HOT 3
- The opus file is seriously distorted, and only one side of the speaker has sound. HOT 3
- When the speex file is playing, only one side of the speaker has sound, and SFBAudioPlayer.totalTime is nil HOT 3
- I keep getting an error when converting to apple native format, like m4a aac HOT 4
- Total frames not calculated for Ogg Speex streams HOT 1
- When encoding to mp3, the bitrate is always 128kbps HOT 5
- LAME encoder settings are confusing HOT 1
- Whatβs the role of SFBFFmpegDecoder HOT 1
- How to set the output sampleRate HOT 1
- OPUS file duration in milliseconds HOT 3
- SFBFLACDecoder - decodeIntoBuffer - not decoding all frames HOT 5
- Add .podspec for Cocoapods
- Looping a decoder region doesn't work HOT 1
- Unable to stream MP3/WAV and possibly other formats HOT 3
- playReturningError failure HOT 6
- How to changed speed
- Importing Package HOT 2
- macOS 14+ dependencies? HOT 6
- Unable to convert some audio formats
- AudioDevice HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sfbaudioengine.