NAP
midioutputport.h
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this
3  * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4 
5 #pragma once
6 
7 // Local Includes
8 #include "midiservice.h"
9 #include "midiportinfo.h"
10 
11 // Nap includes
12 #include <nap/device.h>
13 #include <utility/dllexport.h>
14 
15 namespace nap
16 {
17 
23  class NAPAPI MidiOutputPort : public Device
24  {
25  RTTI_ENABLE(Device)
26  public:
27  MidiOutputPort() = default;
28  MidiOutputPort(MidiService& service);
29  virtual ~MidiOutputPort() override;
30 
36  virtual bool start(utility::ErrorState& errorState) override;
37 
41  virtual void stop() override;
42 
46  MidiService& getService();
47 
52  void sendEvent(const MidiEvent& event);
53 
57  int getPortNumber() const;
58 
59  bool mAllowFailure = false;
60  std::string mPortName = "";
61 
62  private:
63  std::unique_ptr<RtMidiOut> mMidiOut = nullptr;
64  MidiService* mService = nullptr;
65  std::vector<unsigned char> mOutputData;
66  int mPortNumber = -1;
67  };
68 
69  // Object creator used for constructing the the OSC receiver
71 
72 }
nap::rtti::ObjectCreator
Definition: factory.h:49
nap::utility::ErrorState
Definition: errorstate.h:19
nap::MidiEvent
Definition: midievent.h:22
nap::MidiOutputPort
Definition: midioutputport.h:23
nap::MidiService
Definition: midiservice.h:26
nap
Definition: templateapp.h:17
nap::Device
Definition: device.h:20