Comments (16)
is that iOS? (on macOS OF_NO_FMOD=1
still gives errors with some AVAudioSession things being unavailable)
how can I confirm I'm really getting the AVEngine back end?
from openframeworks.
hmm the state machine of that class is hard to follow with the threads, delays etc especially when multi-play, I don't get where how the superposed instances are tracked?
anyhow here it does not crash easily (M1, 14.4.1). I have to click a lot (like 100 clicks in 12 seconds) then I get the above weak self
crash.
adding this to ofAVEngineSoundPlayer.mm
stops the crashes:
- (void)stop {
if (!_bIsPlaying) {
NSLog(@"stop() called before play()");
return;
}
but it feels like a "patch" -- maybe the design needs a bit more robustness.
from openframeworks.
@dimitre I can reproduce here - its crashing here, where the multiplayer objects that are done playing are deleted ( ie the old vector of multiplayer objects gets replaced with the new one ).
I get this message:
objc[26616]: Cannot form weak reference to instance (0x60000002c2d0) of class AVEnginePlayer. It is possible that this object was over-released, or is in the process of deallocation.
I remember stress testing this pretty hard and multiplay used to work, but maybe the ARC changes mean something is getting deleted twice.
from openframeworks.
Not iOS, it is macOS.
I've #ifdef out out the parts that were erroring, I think they are specific to iOS
from openframeworks.
to test this I've copied the example to another project, adding this on App.xcconfig
LIB_FMOD=""
OF_NO_FMOD=1
USER_PREPROCESSOR_DEFINITIONS="OF_NO_FMOD=1"
the line LIB_FMOD one was unexpected, but this was needed to make it work
you can know it is using AVEngine in two different ways:
one is reproduce the error and XCode will lead you to __typeof(self) __weak weak_self = self;
or you can inspect the .app folder and certify there is no fmod there
from openframeworks.
from openframeworks.
Nice! I think @artificiel patch can be applied so things work OK for now.
cc: @2bbb
from openframeworks.
yes _bIsPlaying
being false it indicates the sound is not playing or -- presumably what happens in the crash --not done getting initialized, so should not be deallocated yet.
in which case my patch means "dropping a request" for a sound to play (because play calls stop); ideally things would be locked and pass through once the sound becomes stoppable, presumably a buffer size later or something like that. the patch is good to confirm the problem is there (stopping a sound that's not playing), but the real solution might be in redesign.
but as mentioned the reentrancy features of that class eludes my quick analysis.
from openframeworks.
Yes, please submit a PR
we can use a comment with
//FIXME:
mentioning the needed redesign
from openframeworks.
@artificiel tested here and working. no crashes
from openframeworks.
ok I can look more but I believe @ofTheo wrote that might be more efficient to take a look at it in light of the info here?
also an observation: the crash don't occur on click, but at the end of the sound. it seems there is something going on deallocation that gets somehow invalidated during the lifetime of the dispatch_after
. (maybe the runtime crash error message is not totally correct)
from openframeworks.
from openframeworks.
wow - @artificiel , beat me to it! :D
this also works for me:
but I am not sure if this hides the main bug, but possibly keeps it for the dispatch ( when audio outputs are changed mid playback ).
from openframeworks.
I'm not sure what becomes self
in the dispatch β is it implicitly captured in the block? maybe even (don't schedule a stop if not playing):
anyhow the fix is better, and considering the difficulties of getting audio session/config changes right (even some pro audio software don't react that well while processing is undergoing) maybe a low-priority problem for OF.
(also, the #ifdef'd stuff to get to compile on Mac should also be committed?)
from openframeworks.
Thanks @artificiel - yeah I notice that now it doesn't work anymore when unplugging headphones.
I did have it working where it paused/stopped all audio and recreated it for the new engine and picked up where it left off.
I basically had it working better than some of Apple's own software which would just stop the audio on device switch.
But I'll look into that separately.
Thanks for tracking this issue down!!
I can do a PR for the fix, unless you prefer to do so.
from openframeworks.
please do the PR!
from openframeworks.
Related Issues (20)
- macOS - "Please enable ARC (Automatic Reference Counting) at the project level" HOT 1
- macOS project is copying some addon files to my project folder HOT 1
- ofxAssimp pointing to other folder libs - not compatible with bleeding / latest libs HOT 2
- Server down? HOT 4
- about stroke align with ofSetLineWidth HOT 4
- XCode template with errors on latest HOT 3
- ofImage needs to include "ofPixels.h" HOT 5
- ofLight areaLight using material with some roughness or metallic
- assimp.a not found in latest HOT 2
- ofxSvg in macOS - libs not found HOT 1
- move libs/json/include/json.hpp to libs/json/include/nlohmann/json.hpp HOT 7
- 'openssl/evp.h' file not found HOT 3
- Apothecary - macos libs seems to have ios and tvos libs but not macos HOT 2
- compile issues with nightly build HOT 10
- ofVideoPlayer βpausingβ behaviour discrepancy between platforms (Windows seems problematic)
- MAX_BUFFER_SIZE of UdpSocket in ofxOsc on Windows Env HOT 3
- [ubuntu] allAddonsExample not running HOT 1
- [macOS] make not working due to c++23 HOT 5
- nightly build version missing the rtaudio.dll HOT 1
- [ios simulator] - setupScreenPerspective failing with a NaN HOT 1
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 openframeworks.