Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

implement sequencer #5

Merged
merged 1 commit into from
Jul 30, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions app/app.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ import {Component, Inject} from '@angular/core';
import * as lodash from "lodash";

import {FrameService} from './frame.service';
import {MidiAdaputer} from './midiAdaputer';

const DEFAULT_BPM = 120;

@Component({
selector : 'wm-app',
directives: [],
providers : [FrameService],
providers : [FrameService, MidiAdaputer],
template : `
<style>
:host {
Expand Down Expand Up @@ -47,8 +48,11 @@ const DEFAULT_BPM = 120;
`
})
export class AppComponent {
constructor(@Inject(FrameService) frame) {
constructor(@Inject(FrameService) frame,
@Inject(MidiAdaputer) midiAdapter) {
this.frame = frame;
this.midiAdapter = midiAdapter;

this.range = 16;
this.grids = lodash.range(this.range).map((i) => {
return {
Expand Down Expand Up @@ -88,6 +92,10 @@ export class AppComponent {
this.frame.run(this.bpm);
this.disposable = this.frame.observable.subscribe((f) => {
this.f = f;
const current = this.f % this.grids.length;
if (this.grids[current].note) {
this.midiAdapter.emit(current);
}
});
}

Expand Down