mirror of
https://github.com/AxioDL/boo.git
synced 2025-12-16 08:27:10 +00:00
Add IMIDIPort, initial ALSA midiport implementation
This commit is contained in:
@@ -3,7 +3,9 @@
|
||||
|
||||
#include "IAudioVoice.hpp"
|
||||
#include "IAudioSubmix.hpp"
|
||||
#include "IMIDIPort.hpp"
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
namespace boo
|
||||
{
|
||||
@@ -38,6 +40,27 @@ struct IAudioVoiceEngine
|
||||
|
||||
/** Ensure backing platform buffer is filled as much as possible with mixed samples */
|
||||
virtual void pumpAndMixVoices()=0;
|
||||
|
||||
/** Get list of MIDI devices found on system */
|
||||
virtual std::vector<std::string> enumerateMIDIDevices() const=0;
|
||||
|
||||
/** Create ad-hoc MIDI in port and register with system */
|
||||
virtual std::unique_ptr<IMIDIIn> newVirtualMIDIIn()=0;
|
||||
|
||||
/** Create ad-hoc MIDI out port and register with system */
|
||||
virtual std::unique_ptr<IMIDIOut> newVirtualMIDIOut()=0;
|
||||
|
||||
/** Create ad-hoc MIDI in/out port and register with system */
|
||||
virtual std::unique_ptr<IMIDIInOut> newVirtualMIDIInOut()=0;
|
||||
|
||||
/** Open named MIDI in port, name format depends on OS */
|
||||
virtual std::unique_ptr<IMIDIIn> newRealMIDIIn(const char* name)=0;
|
||||
|
||||
/** Open named MIDI out port, name format depends on OS */
|
||||
virtual std::unique_ptr<IMIDIOut> newRealMIDIOut(const char* name)=0;
|
||||
|
||||
/** Open named MIDI in/out port, name format depends on OS */
|
||||
virtual std::unique_ptr<IMIDIInOut> newRealMIDIInOut(const char* name)=0;
|
||||
};
|
||||
|
||||
/** Construct host platform's voice engine */
|
||||
|
||||
38
include/boo/audiodev/IMIDIPort.hpp
Normal file
38
include/boo/audiodev/IMIDIPort.hpp
Normal file
@@ -0,0 +1,38 @@
|
||||
#ifndef BOO_IMIDIPORT_HPP
|
||||
#define BOO_IMIDIPORT_HPP
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace boo
|
||||
{
|
||||
|
||||
class IMIDIPort
|
||||
{
|
||||
public:
|
||||
virtual ~IMIDIPort() = default;
|
||||
virtual bool isVirtual() const=0;
|
||||
virtual std::string description() const=0;
|
||||
};
|
||||
|
||||
class IMIDIIn : public IMIDIPort
|
||||
{
|
||||
public:
|
||||
virtual size_t receive(void* buf, size_t len) const=0;
|
||||
};
|
||||
|
||||
class IMIDIOut : public IMIDIPort
|
||||
{
|
||||
public:
|
||||
virtual size_t send(const void* buf, size_t len) const=0;
|
||||
};
|
||||
|
||||
class IMIDIInOut : public IMIDIPort
|
||||
{
|
||||
public:
|
||||
virtual size_t send(const void* buf, size_t len) const=0;
|
||||
virtual size_t receive(void* buf, size_t len) const=0;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // BOO_IMIDIPORT_HPP
|
||||
Reference in New Issue
Block a user