import{A as e}from"./webAudioBaseSubGraph-t3b9YWn8.js";class p extends e{constructor(t,i,s,a=2){super(t,i,a),this._spatialAutoUpdate=!0,this._spatialMinUpdateTime=0,this._outBus=null,this._spatial=null,this._onOutBusDisposed=null,typeof s.spatialAutoUpdate=="boolean"&&(this._spatialAutoUpdate=s.spatialAutoUpdate),typeof s.spatialMinUpdateTime=="number"&&(this._spatialMinUpdateTime=s.spatialMinUpdateTime)}get outBus(){return this._outBus}set outBus(t){if(this._outBus!==t){if(this._outBus&&(this._onOutBusDisposed&&(this._outBus.onDisposeObservable.removeCallback(this._onOutBusDisposed),this._onOutBusDisposed=null),!this._disconnect(this._outBus)))throw new Error("Disconnect failed");if(this._outBus=t,this._outBus&&(this._onOutBusDisposed=()=>{this._outBus=null},this._outBus.onDisposeObservable.add(this._onOutBusDisposed),!this._connect(this._outBus)))throw new Error("Connect failed")}}get spatial(){return this._spatial?this._spatial:this._initSpatialProperty()}dispose(){super.dispose(),this._spatial?.dispose(),this._spatial=null,this._outBus&&this._onOutBusDisposed&&(this._outBus.onDisposeObservable.removeCallback(this._onOutBusDisposed),this._onOutBusDisposed=null),this._outBus=null}_initSpatialProperty(){return this._spatial=this._createSpatialProperty(this._spatialAutoUpdate,this._spatialMinUpdateTime)}get _isSpatial(){return this._spatial!==null}set _isSpatial(t){t&&!this._spatial?this._initSpatialProperty():!t&&this._spatial&&(this._spatial.dispose(),this._spatial=null)}}export{p as A};
