Skip to content

Commit f40eaa0

Browse files
committed
Update processor.js
1 parent 7a187cb commit f40eaa0

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/processor.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ if (!(typeof SepiaFW == "object")){
129129
if (Object.keys(initConditions).length == 0){
130130
if (!isInitialized){
131131
clearTimeout(initTimeoutTimer);
132+
isInitialized = true;
133+
isInitPending = false;
132134
initSuccessCallback({
133135
name: "ProcessorReady",
134136
message: "Processor is ready for action",
@@ -137,8 +139,6 @@ if (!(typeof SepiaFW == "object")){
137139
sourceInfo: sourceInitInfo,
138140
modulesInfo: modulesInitInfo
139141
});
140-
isInitialized = true;
141-
isInitPending = false;
142142
}
143143
}
144144
}
@@ -655,34 +655,37 @@ if (!(typeof SepiaFW == "object")){
655655

656656
//INTERFACE
657657

658-
thisProcessor.start = function(){
658+
thisProcessor.start = function(callback){
659659
if (isInitialized && !isProcessing){
660660
startFun(function(){
661661
var startTime = new Date().getTime(); //TODO: is this maybe already too late?
662662
setStateProcessing();
663663
if (options.onaudiostart) options.onaudiostart({
664664
startTime: startTime
665665
});
666+
if (callback) callback();
666667
});
667668
}
668669
}
669670

670-
thisProcessor.stop = function(){
671+
thisProcessor.stop = function(callback){
671672
if (isProcessing){
672673
stopFun(function(){
673674
var endTime = new Date().getTime(); //TODO: is this maybe already too late?
674675
setStateProcessingStop();
675676
if (options.onaudioend) options.onaudioend({
676677
endTime: endTime
677678
});
679+
if (callback) callback();
678680
});
679681
}
680682
}
681683

682-
thisProcessor.release = function(){
684+
thisProcessor.release = function(callback){
683685
releaseFun(function(){
684686
setStateProcessorReleased();
685687
if (options.onrelease) options.onrelease();
688+
if (callback) callback();
686689
});
687690
}
688691
}

0 commit comments

Comments
 (0)