MIDIOutput.h (1445B)
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim:set ts=2 sw=2 sts=2 et cindent: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef mozilla_dom_MIDIOutput_h 8 #define mozilla_dom_MIDIOutput_h 9 10 #include "mozilla/dom/MIDIPort.h" 11 12 struct JSContext; 13 14 namespace mozilla { 15 class ErrorResult; 16 17 namespace dom { 18 19 class MIDIPortInfo; 20 class MIDIMessage; 21 22 /** 23 * Represents a MIDI Output Port, handles sending message to devices. 24 * 25 */ 26 class MIDIOutput final : public MIDIPort { 27 public: 28 static RefPtr<MIDIOutput> Create(nsPIDOMWindowInner* aWindow, 29 MIDIAccess* aMIDIAccessParent, 30 const MIDIPortInfo& aPortInfo, 31 const bool aSysexEnabled); 32 ~MIDIOutput() = default; 33 34 JSObject* WrapObject(JSContext* aCx, 35 JS::Handle<JSObject*> aGivenProto) override; 36 37 // Send a message to an output port 38 void Send(const Sequence<uint8_t>& aData, const Optional<double>& aTimestamp, 39 ErrorResult& aRv); 40 // Clear any partially sent messages from the send queue 41 void Clear(); 42 43 private: 44 explicit MIDIOutput(nsPIDOMWindowInner* aWindow); 45 }; 46 47 } // namespace dom 48 } // namespace mozilla 49 50 #endif // mozilla_dom_MIDIOutput_h