amuse/include/amuse/IBackendVoiceAllocator.hpp

51 lines
1.6 KiB
C++
Raw Normal View History

2018-10-07 03:40:25 +00:00
#pragma once
#include <memory>
2016-05-19 10:12:32 +00:00
#include <functional>
#include <vector>
2018-12-08 05:20:09 +00:00
namespace amuse {
class IBackendVoice;
2016-05-07 22:10:57 +00:00
class IBackendSubmix;
class Voice;
2016-05-07 22:10:57 +00:00
class Submix;
class Engine;
/** Same enum as boo for describing speaker-configuration */
2018-12-08 05:20:09 +00:00
enum class AudioChannelSet { Stereo, Quad, Surround51, Surround71, Unknown = 0xff };
/** Handle to MIDI-reader, implementation opaque */
2018-12-08 05:20:09 +00:00
class IMIDIReader {
public:
2018-12-08 05:20:09 +00:00
virtual ~IMIDIReader() = default;
virtual void pumpReader(double dt) = 0;
};
2016-05-19 05:55:10 +00:00
/** Client-implemented voice allocator */
2018-12-08 05:20:09 +00:00
class IBackendVoiceAllocator {
public:
2018-12-08 05:20:09 +00:00
virtual ~IBackendVoiceAllocator() = default;
2018-12-08 05:20:09 +00:00
/** Amuse obtains a new voice from the platform this way */
virtual std::unique_ptr<IBackendVoice> allocateVoice(Voice& clientVox, double sampleRate, bool dynamicPitch) = 0;
2016-05-07 22:10:57 +00:00
2018-12-08 05:20:09 +00:00
/** Amuse obtains a new submix from the platform this way */
virtual std::unique_ptr<IBackendSubmix> allocateSubmix(Submix& clientSmx, bool mainOut, int busId) = 0;
2018-12-08 05:20:09 +00:00
/** Amuse obtains a list of all MIDI devices this way */
virtual std::vector<std::pair<std::string, std::string>> enumerateMIDIDevices() = 0;
2018-12-08 05:20:09 +00:00
/** Amuse obtains an interactive MIDI-in connection from the OS this way */
virtual std::unique_ptr<IMIDIReader> allocateMIDIReader(Engine& engine) = 0;
2018-12-08 05:20:09 +00:00
/** Amuse obtains speaker-configuration from the platform this way */
virtual AudioChannelSet getAvailableSet() = 0;
2016-05-14 04:46:39 +00:00
2018-12-08 05:20:09 +00:00
/** Set volume of main mix out */
virtual void setVolume(float vol) = 0;
2018-12-08 05:20:09 +00:00
/** Amuse registers for key callback events from the mixing engine this way */
virtual void setCallbackInterface(Engine* engine) = 0;
};
2018-12-08 05:20:09 +00:00
} // namespace amuse