13
0

Extend 1de0542

Make Mixer and Transport subclasses of ChildComponent
This commit is contained in:
Luciano Iam 2020-06-14 13:04:43 +02:00 committed by Robin Gareus
parent d65e1170b9
commit c4ead80613
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
4 changed files with 12 additions and 16 deletions

View File

@ -32,8 +32,8 @@ export default class ArdourClient extends Component {
super(new MessageChannel(getOption(options, 'host', location.host))); super(new MessageChannel(getOption(options, 'host', location.host)));
if (getOption(options, 'components', true)) { if (getOption(options, 'components', true)) {
this._mixer = new Mixer(this.channel); this._mixer = new Mixer(this);
this._transport = new Transport(this.channel); this._transport = new Transport(this);
this._components = [this._mixer, this._transport]; this._components = [this._mixer, this._transport];
} else { } else {
this._components = []; this._components = [];

View File

@ -22,7 +22,7 @@ import Observable from './observable.js';
export class Component extends Observable { export class Component extends Observable {
constructor (channel) { constructor (channel) {
super(null); super();
this._channel = channel; this._channel = channel;
} }
@ -65,14 +65,10 @@ export class Component extends Observable {
export class ChildComponent extends Component { export class ChildComponent extends Component {
constructor (parent) { constructor (parent) {
super(); super(parent.channel);
this._parent = parent; this._parent = parent;
} }
get channel () {
return this._parent.channel;
}
} }
export class AddressableComponent extends ChildComponent { export class AddressableComponent extends ChildComponent {

View File

@ -16,14 +16,14 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
import { Component } from '../base/component.js'; import { ChildComponent } from '../base/component.js';
import { StateNode } from '../base/protocol.js'; import { StateNode } from '../base/protocol.js';
import Strip from './strip.js'; import Strip from './strip.js';
export default class Mixer extends Component { export default class Mixer extends ChildComponent {
constructor (channel) { constructor (parent) {
super(channel); super(parent);
this._strips = {}; this._strips = {};
this._ready = false; this._ready = false;
} }

View File

@ -16,7 +16,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
import { Component } from '../base/component.js'; import { ChildComponent } from '../base/component.js';
import { StateNode } from '../base/protocol.js'; import { StateNode } from '../base/protocol.js';
const NodeToProperty = Object.freeze({ const NodeToProperty = Object.freeze({
@ -26,10 +26,10 @@ const NodeToProperty = Object.freeze({
[StateNode.TRANSPORT_RECORD] : 'record' [StateNode.TRANSPORT_RECORD] : 'record'
}); });
export default class Transport extends Component { export default class Transport extends ChildComponent {
constructor (channel) { constructor (parent) {
super(channel); super(parent);
this._time = 0; this._time = 0;
this._tempo = 0; this._tempo = 0;
this._roll = false; this._roll = false;