Skip to content

Commit

Permalink
Stop chant audio when chant is changed
Browse files Browse the repository at this point in the history
  • Loading branch information
dchiller committed Sep 7, 2023
1 parent 5c05b2b commit 242d1be
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import Backbone from 'backbone';
import Marionette from 'marionette';

import { parseVolpianoSyllables } from 'utils/VolpianoDisplayHelper';
Expand All @@ -6,6 +7,8 @@ import template from './chant-record.template.html';

import { MIDI } from 'utils/midi-player/midiPlayer.js';

var manuscriptChannel = Backbone.Radio.channel('manuscript');

MIDI.audioDetect(function (supports){
MIDI.supports = supports;
var soundfontUrl = "/static/soundfonts/";
Expand Down Expand Up @@ -242,6 +245,7 @@ export default Marionette.ItemView.extend({
this.model.set('volpiano', formattedVolpiano);
var cdb_uri = this.model.get('cdb_uri');
this.model.set({ 'cdb_link_url': 'https://cantus.uwaterloo.ca/node/' + cdb_uri });
this.listenTo(manuscriptChannel, 'change:chant', this.chantChanged);
},
ui : {
volpianoSyllables: ".volpiano-syllable",
Expand All @@ -260,5 +264,10 @@ export default Marionette.ItemView.extend({
},
stop: function(){
audioStopReset(MIDI);
},
chantChanged: function(){
if (MIDI.getContext().state === "running"){
audioStopReset(MIDI);
}
}
});

0 comments on commit 242d1be

Please sign in to comment.