2018-10-07 03:40:25 +00:00
|
|
|
#pragma once
|
2016-05-25 02:00:22 +00:00
|
|
|
#ifdef __APPLE__
|
|
|
|
|
|
|
|
#include <Availability.h>
|
|
|
|
|
|
|
|
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101100
|
|
|
|
#define AMUSE_HAS_AUDIO_UNIT 1
|
|
|
|
|
|
|
|
#include <AudioUnit/AudioUnit.h>
|
|
|
|
|
2019-06-12 02:02:52 +00:00
|
|
|
#include <optional>
|
2016-05-25 02:00:22 +00:00
|
|
|
|
|
|
|
#include "amuse/BooBackend.hpp"
|
|
|
|
#include "amuse/Engine.hpp"
|
|
|
|
#include "amuse/IBackendVoice.hpp"
|
|
|
|
#include "amuse/IBackendSubmix.hpp"
|
|
|
|
#include "amuse/IBackendVoiceAllocator.hpp"
|
2016-06-07 03:42:51 +00:00
|
|
|
#import "AudioGroupFilePresenter.hpp"
|
2016-05-25 02:00:22 +00:00
|
|
|
|
2016-06-07 03:42:51 +00:00
|
|
|
@class AudioUnitViewController;
|
2016-05-25 02:00:22 +00:00
|
|
|
|
2018-12-08 05:20:09 +00:00
|
|
|
namespace amuse {
|
2016-05-25 02:00:22 +00:00
|
|
|
|
|
|
|
/** Backend voice allocator implementation for AudioUnit mixer */
|
2018-12-08 05:20:09 +00:00
|
|
|
class AudioUnitBackendVoiceAllocator : public BooBackendVoiceAllocator {
|
2016-05-25 02:00:22 +00:00
|
|
|
public:
|
2018-12-08 05:20:09 +00:00
|
|
|
AudioUnitBackendVoiceAllocator(boo::IAudioVoiceEngine& booEngine) : BooBackendVoiceAllocator(booEngine) {}
|
2016-05-25 02:00:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
void RegisterAudioUnit();
|
2018-12-08 05:20:09 +00:00
|
|
|
} // namespace amuse
|
2016-05-25 02:00:22 +00:00
|
|
|
|
2018-12-08 05:20:09 +00:00
|
|
|
@interface AmuseAudioUnit : AUAudioUnit <AudioGroupClient> {
|
2016-06-07 03:42:51 +00:00
|
|
|
@public
|
2018-12-08 05:20:09 +00:00
|
|
|
AudioUnitViewController* m_viewController;
|
|
|
|
std::unique_ptr<boo::IAudioVoiceEngine> m_booBackend;
|
2019-06-12 02:02:52 +00:00
|
|
|
std::optional<amuse::AudioUnitBackendVoiceAllocator> m_voxAlloc;
|
|
|
|
std::optional<amuse::Engine> m_engine;
|
2018-12-08 05:20:09 +00:00
|
|
|
AudioGroupFilePresenter* m_filePresenter;
|
|
|
|
AUAudioUnitBus* m_outBus;
|
|
|
|
AUAudioUnitBusArray* m_outs;
|
2016-05-25 02:00:22 +00:00
|
|
|
}
|
2016-06-07 03:42:51 +00:00
|
|
|
- (nullable id)initWithComponentDescription:(AudioComponentDescription)componentDescription
|
2016-07-14 04:54:46 +00:00
|
|
|
error:(NSError* __nullable* __nonnull)outError
|
2016-06-07 03:42:51 +00:00
|
|
|
viewController:(AudioUnitViewController* __nonnull)vc;
|
2016-06-22 04:18:28 +00:00
|
|
|
- (void)requestAudioGroup:(AudioGroupToken* _Nonnull)group;
|
2016-05-25 02:00:22 +00:00
|
|
|
@end
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|