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 #include "mozilla/dom/MIDIPortInterface.h"
8 #include "mozilla/dom/MIDIPlatformService.h"
9 #include "mozilla/dom/MIDITypes.h"
10
MIDIPortInterface(const MIDIPortInfo & aPortInfo,bool aSysexEnabled)11 MIDIPortInterface::MIDIPortInterface(const MIDIPortInfo& aPortInfo,
12 bool aSysexEnabled)
13 : mId(aPortInfo.id()),
14 mName(aPortInfo.name()),
15 mManufacturer(aPortInfo.manufacturer()),
16 mVersion(aPortInfo.version()),
17 mSysexEnabled(aSysexEnabled),
18 mType((MIDIPortType)aPortInfo.type()),
19 // We'll never initialize a port object that's not connected
20 mDeviceState(MIDIPortDeviceState::Connected),
21 // Open everything on connection
22 mConnectionState(MIDIPortConnectionState::Open),
23 mShuttingDown(false) {}
24
~MIDIPortInterface()25 MIDIPortInterface::~MIDIPortInterface() { Shutdown(); }
26
Shutdown()27 void MIDIPortInterface::Shutdown() { mShuttingDown = true; }
28