Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reinit. Audio Engine for MegaDrone on restart. #523

Merged
merged 6 commits into from
May 31, 2019
Merged

Reinit. Audio Engine for MegaDrone on restart. #523

merged 6 commits into from
May 31, 2019

Conversation

atneya
Copy link
Collaborator

@atneya atneya commented May 23, 2019

Fixes #521

@atneya atneya requested review from dturner and philburk May 23, 2019 22:51
…s. This refactor impacted MegaDrone and RhythmGame.

This prevents ambiguous ownership of audio components, leaving the owner of the Mixer as the sole owner of the inputs to the Mixer.
This allows for objects with the Mixer as a member along with its inputs to control their duration automatically, in aggregate.
This fixes crashes on destruction of objects composing the Mixer and various inputs. (E.g. Fixes #521).
@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@atneya
Copy link
Collaborator Author

atneya commented May 28, 2019

Changed username, replying to recheck CLA

@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

// Rendering objects
std::array<Oscillator, kNumOscillators> mOscs;
Mixer mMixer;
std::shared_ptr<IRenderableAudio> mOutputStage;
MonoToStereo mConverter = MonoToStereo(&mMixer);
IRenderableAudio *mOutputStage; // This will point to either the mixer or converter
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be declared const? The pointer will not change after the constructor.

IRenderableAudio * const mOutputStage; // const pointer to mutable object

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using a const ptr is a little bit messy because of the need to initialize prior to the constructor.
If it is clearer, we can use a non-const pointer and have it instantiated as before.

I see what you mean. This is messy. Feel free to go back to the original.

Copy link
Collaborator Author

@atneya atneya May 30, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted back in latest commit

samples/RhythmGame/src/main/cpp/Game.h Outdated Show resolved Hide resolved
samples/shared/Mixer.h Show resolved Hide resolved
samples/MegaDrone/src/main/cpp/Synth.h Outdated Show resolved Hide resolved
@atneya
Copy link
Collaborator Author

atneya commented May 28, 2019

Using a const ptr is a little bit messy because of the need to initialize prior to the constructor. If it is clearer, we can use a non-const pointer and have it instantiated as before.

@atneya atneya requested a review from philburk May 29, 2019 17:33
@atneya atneya merged commit f4172d0 into master May 31, 2019
@atneya atneya deleted the issue-521 branch May 31, 2019 18:14
@dturner
Copy link
Collaborator

dturner commented Jun 3, 2019

Many thanks for fixing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[samples/MegaDrone] Crashes when onResume is called
4 participants