changeset 909:68bc26353ada

audioObject returned on node creation for ease of modification by interface.
author Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk>
date Thu, 04 Jun 2015 11:21:47 +0100
parents 40f9b1725279
children f938025db0d7
files ape.js core.js
diffstat 2 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/ape.js	Thu Jun 04 11:18:21 2015 +0100
+++ b/ape.js	Thu Jun 04 11:21:47 2015 +0100
@@ -333,8 +333,8 @@
 		
 		// Now load each audio sample. First create the new track by passing the full URL
 		var trackURL = hostURL + this.attributes['url'].value;
-		audioEngineContext.newTrack(trackURL);
-		audioEngineContext.audioObjects[index].id = this.attributes['id'].value;
+		var audioObject = audioEngineContext.newTrack(trackURL);
+		audioObject.id = this.attributes['id'].value;
 		
 		if (commentShow) {
 			// Create document objects to hold the comment boxes
@@ -356,7 +356,7 @@
 			trackComment.appendChild(br);
 			trackComment.appendChild(trackCommentBox);
 			feedbackHolder.appendChild(trackComment);
-			audioEngineContext.audioObjects[index].commentDOM = trackComment;
+			audioObject.commentDOM = trackComment;
 		}
 		
 		// Create a slider per track
@@ -404,10 +404,10 @@
 		};
 		
 		// Attach binding
-		audioEngineContext.audioObjects[index].sliderDOM = trackSliderObj;
+		audioObject.sliderDOM = trackSliderObj;
 		
 		canvas.appendChild(trackSliderObj);
-		audioEngineContext.audioObjects[index].metric.initialised(convSliderPosToRate(index));
+		audioObject.metric.initialised(convSliderPosToRate(index));
         
 	});
 	
--- a/core.js	Thu Jun 04 11:18:21 2015 +0100
+++ b/core.js	Thu Jun 04 11:21:47 2015 +0100
@@ -553,6 +553,7 @@
 
 		// AudioObject will get track itself.
 		this.audioObjects[audioObjectId].constructTrack(url);
+		return this.audioObjects[audioObjectId];
 	};
 	
 	this.newTestPage = function() {