Skip to content

Commit

Permalink
FLOE-437: more refactoring; use invoker for conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
waharnum committed Jan 28, 2016
1 parent 42029c7 commit b8d21cd
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/js/sonifier.js
Expand Up @@ -77,6 +77,7 @@ var flockingEnvironment = flock.init();
strategies: {
unitDivisor: {
config: {
unitDivisorValue: 10,
notes: {
durations: {
divisorReturnValue: 3/8,
Expand Down Expand Up @@ -128,6 +129,10 @@ var flockingEnvironment = flock.init();
"beginSonificationQueue": {
funcName: "floe.chartAuthoring.sonifier.processSonificationQueue",
args: [0, true, "{that}"]
},
"unitDivisorSonificationStrategy": {
funcName: "floe.chartAuthoring.sonifier.unitDivisorStrategy",
args: ["{that}", "{that}.options.sonificationOptions.strategies.unitDivisor.config.unitDivisorValue"]
}
},
events: {
Expand All @@ -144,16 +149,14 @@ var flockingEnvironment = flock.init();
// convert it to an array of objects in the style used by the sonification components,
// maintaining object constancy by using the dataEntry object name as the key
floe.chartAuthoring.sonifier.dataEntriesToSonificationData = function(that) {
var unitDivisor = 10;
var sonificationData = floe.chartAuthoring.sonifier.unitDivisorSonificationStrategy(that, unitDivisor);
sonificationData.sort(floe.chartAuthoring.utils.sortAscending);
var sonificationData = that.unitDivisorSonificationStrategy();
that.applier.change("sonifiedData",sonificationData);
};

// Creates a sonified data set based on unit divisors
// Longer tones represent the unit divisor, while a short tones is played
// for each remaining "1" of the remainder
floe.chartAuthoring.sonifier.unitDivisorSonificationStrategy = function(that, unitDivisor) {
floe.chartAuthoring.sonifier.unitDivisorStrategy = function(that, unitDivisor) {
var dataSet = that.model.dataSet;

var totalValue = that.model.total.value;
Expand Down Expand Up @@ -193,7 +196,7 @@ var flockingEnvironment = flock.init();
}

});

sonificationData.sort(floe.chartAuthoring.utils.sortAscending);
return sonificationData;
};

Expand Down

0 comments on commit b8d21cd

Please sign in to comment.