Skip to content

Commit f52bc0f

Browse files
author
Salma Alam-Naylor
committed
Insert playback service into scale map
1 parent 2af2240 commit f52bc0f

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

apps/fretonator-web/src/app/common/fretonator/scale-map/scale-map.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ <h5 class="scaleDisplay__note">
1313
<button class="button__playScale"
1414
aria-label="Play this scale"
1515
type="button"
16-
(click)="playScale()">
16+
(click)="playScale(modeMap)">
1717
<span class="button__playScale__svg">
1818
<app-play-svg></app-play-svg>
1919
</span>

apps/fretonator-web/src/app/common/fretonator/scale-map/scale-map.component.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Component, Input } from '@angular/core';
22
import { Mode, ModeMap, Scale } from '../../../util/types';
3+
import { NotePlaybackService } from '../../playback/note-playback.service';
34

45
enum ScaleDegreesToggleText {
56
hidden = 'What is this?',
@@ -30,6 +31,9 @@ export class ScaleMapComponent {
3031
scaleDegreesToggleText = ScaleDegreesToggleText.hidden;
3132
theoreticalScalesToggleText = TheoreticalScalesToggleText.hidden;
3233

34+
constructor(public playbackService: NotePlaybackService) {
35+
}
36+
3337
toggleScaleMapInfo() {
3438
this.showScaleMapInfo = !this.showScaleMapInfo;
3539
this.scaleDegreesToggleText = this.showScaleMapInfo ? ScaleDegreesToggleText.visible : ScaleDegreesToggleText.hidden;
@@ -40,7 +44,7 @@ export class ScaleMapComponent {
4044
this.theoreticalScalesToggleText = this.showTheoreticalScalesInfo ? TheoreticalScalesToggleText.visible : TheoreticalScalesToggleText.hidden;
4145
}
4246

43-
playScale() {
44-
console.log('playing');
47+
playScale(modeMap: ModeMap) {
48+
this.playbackService.playMode(modeMap);
4549
}
4650
}

apps/fretonator-web/src/app/common/playback/note-playback.service.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Injectable } from '@angular/core';
22
import { StringFrequencies } from '../../util/constants';
3+
import { ModeMap } from '../../util/types';
34

45
const SYNTH_BUFFER_SIZE = 4096;
56
const SYNTH_PLAY_DURATION = 2000;
@@ -27,6 +28,11 @@ export class NotePlaybackService {
2728
}
2829
}
2930

31+
playMode(modeMap: ModeMap) {
32+
console.log('playMode called!');
33+
console.log(modeMap);
34+
}
35+
3036
private getFrequency(stringName, fret) {
3137
// We're using stringName here, the case sensitive alt to string, to differentiate E/e strings.
3238
const stringFrequency = StringFrequencies[stringName];

0 commit comments

Comments
 (0)