Exemplo n.º 1
0
 private void handleDeactivationIntent(Intent intent)
 {
     lock (this)
     {
         SapaApp sapaApp = SapaAppInfo.getApp(intent);
         this.mActionsList.Remove(sapaApp.InstanceId);
         foreach (KeyValuePair <string, SapaProcessor> entry in this.mProcessorList.SetOfKeyValuePairs())
         {
             Log.d(TAG, "kakakaka " + entry.Key + " -> " + entry.Value);
         }
         SapaProcessor processor = this.mProcessorList[sapaApp.InstanceId];
         Log.d(TAG, "kakakaka instanceId " + sapaApp.InstanceId + " processor " + processor);
         processor.deactivate();
         this.mSapaService.unregister(this.mProcessorList[sapaApp.InstanceId]);
         this.mProcessorList.Remove(sapaApp.InstanceId);
         try
         {
             this.mSapaAppService.removeFromActiveApps(sapaApp);
         }
         catch (SapaConnectionNotSetException e)
         {
             Log.e(TAG, "Instance could not be removed from active list because of connection exception.");
         }
         this.mAppInfoList.Remove(sapaApp.InstanceId);
     }
 }
Exemplo n.º 2
0
        private void closeAnInstance(string instanceId)
        {
            // Native part of application is being deactivated.
            if (this.mSapaService != null && this.mProcessorList != null && this.mProcessorList.Count > 0)
            {
                SapaProcessor processor = this.mProcessorList[instanceId];
                if (processor != null)
                {
                    processor.deactivate();
                    mSapaService.unregister(processor);
                    mProcessorList.Remove(instanceId);
                }
            }

            if (this.mAppInfoList != null && this.mAppInfoList.Count > 0)
            {
                SapaAppInfo sapaAppInfo = this.mAppInfoList[instanceId];
                if (sapaAppInfo != null && sapaAppInfo.App != null)
                {
                    try
                    {
                        // Application needs to declare that its instance was
                        // successfully deactivated.
                        mSapaAppService.removeFromActiveApps(sapaAppInfo.App);
                        mAppInfoList.Remove(instanceId);
                    }
                    catch (SapaConnectionNotSetException e)
                    {
                        Log.e(TAG, "Instance could not be removed from active list because of connection exception.");
                    }
                }
            }
            mCallerPackageNameList.Remove(instanceId);
            mActionsList.Remove(instanceId);
        }
Exemplo n.º 3
0
        public override void onServiceConnected()
        {
            Log.d(TAG, "onServiceConnected");
            try
            {
                if (this.mMyInfo == null)
                {
                    mMyInfo = mSapaAppService.getInstalledApp(this.PackageName);
                }
                if (mMyInfo != null)
                {
                    //Actions are being set in SapaAppInfo representing this application.
                    mActionArray = new SparseArray <SapaActionInfo>();
                    mActionArray.put(0, new SapaActionInfo(COMMAND_SHUSH, R.drawable.ctrl_btn_stop_default, PackageName));
                    mMyInfo.Actions = mActionArray;

                    //Native part is being initialised.
                    Sapa sapa = new Sapa();
                    sapa.initialize(this);
                    mSapaService   = new SapaService();
                    mSapaProcessor = new SapaProcessor(this, null, new SapaProcessorStateListener(this, mMyInfo.App));
                    mSapaService.register(mSapaProcessor);
                    mSapaProcessor.activate();

                    //Information about ports is being set in SapaAppInfo representing this app.
                    //It can not be done before activating SapaProcessor.
                    mMyInfo.PortFromSapaProcessor = mSapaProcessor;

                    //Application needs to declare that it was successfully activated.
                    if (mSapaAppService != null)
                    {
                        this.mSapaAppService.addActiveApp(this.mMyInfo);
                    }
                }
            }
            catch (SapaConnectionNotSetException e)
            {
                Log.e(TAG, "App could not be added to active as connection has not been made.");
            }
            catch (System.ArgumentException e)
            {
                Log.e(TAG, "Initialisation of Sapa is not possible due to invalid context of application");
            }
            catch (SsdkUnsupportedException e)
            {
                Log.e(TAG, "Initialisation of Sapa is not possible as Sapa is not available on the device");
            }
            catch (InstantiationException e)
            {
                Log.e(TAG, "SapaService can not be instantiate");
            }
        }
Exemplo n.º 4
0
 protected internal override void onDestroy()
 {
     base.onDestroy();
     if (mService != null)
     {
         if (mProcessor != null)
         {
             mService.unregister(mProcessor);
             mProcessor = null;
         }
         mService.stop(false);
     }
 }
		public override void onCreate(Bundle savedInstanceState)
		{
			base.onCreate(savedInstanceState);
			ContentView = R.layout.activity_apasimple_client;

			try
			{
				Sapa sapa = new Sapa();
				sapa.initialize(this);
				mService = new SapaService();
				mService.stop(true);
				mService.start(SapaService.START_PARAM_DEFAULT_LATENCY);
				mClient = new SapaProcessor(this, null, new StatusListenerAnonymousInnerClassHelper(this));
				mService.register(mClient);

			}
			catch (SsdkUnsupportedException e)
			{
				Console.WriteLine(e.ToString());
				Console.Write(e.StackTrace);
				Toast.makeText(this, "not support professional audio", Toast.LENGTH_LONG).show();
				finish();
				return;
			}
			catch (InstantiationException e)
			{
				Console.WriteLine(e.ToString());
				Console.Write(e.StackTrace);
				Toast.makeText(this, "fail to instantiate", Toast.LENGTH_LONG).show();
				finish();
				return;
			}
			catch (AndroidRuntimeException e)
			{
				Console.WriteLine(e.ToString());
				Console.Write(e.StackTrace);
				Toast.makeText(this, "fail to start", Toast.LENGTH_LONG).show();
				finish();
				return;
			}

			mPlayButton = (Button) this.findViewById(R.id.play_button);
			mPlayButton.OnClickListener = new OnClickListenerAnonymousInnerClassHelper(this);

			mActivateButton = (Button) this.findViewById(R.id.button_activate);
			mActivateButton.OnClickListener = new OnClickListenerAnonymousInnerClassHelper2(this);

			mDeactivateButton = (Button) this.findViewById(R.id.button_deactivate);
			mDeactivateButton.OnClickListener = new OnClickListenerAnonymousInnerClassHelper3(this);
		}
Exemplo n.º 6
0
        public override void onCreate(Bundle savedInstanceState)
        {
            base.onCreate(savedInstanceState);
            ContentView = R.layout.activity_apasimple_client;

            try
            {
                Sapa sapa = new Sapa();
                sapa.initialize(this);
                mService = new SapaService();
                mService.stop(true);
                mService.start(SapaService.START_PARAM_DEFAULT_LATENCY);
                mClient = new SapaProcessor(this, null, new StatusListenerAnonymousInnerClassHelper(this));
                mService.register(mClient);
            }
            catch (SsdkUnsupportedException e)
            {
                Console.WriteLine(e.ToString());
                Console.Write(e.StackTrace);
                Toast.makeText(this, "not support professional audio", Toast.LENGTH_LONG).show();
                finish();
                return;
            }
            catch (InstantiationException e)
            {
                Console.WriteLine(e.ToString());
                Console.Write(e.StackTrace);
                Toast.makeText(this, "fail to instantiate", Toast.LENGTH_LONG).show();
                finish();
                return;
            }
            catch (AndroidRuntimeException e)
            {
                Console.WriteLine(e.ToString());
                Console.Write(e.StackTrace);
                Toast.makeText(this, "fail to start", Toast.LENGTH_LONG).show();
                finish();
                return;
            }

            mPlayButton = (Button)this.findViewById(R.id.play_button);
            mPlayButton.OnClickListener = new OnClickListenerAnonymousInnerClassHelper(this);

            mActivateButton = (Button)this.findViewById(R.id.button_activate);
            mActivateButton.OnClickListener = new OnClickListenerAnonymousInnerClassHelper2(this);

            mDeactivateButton = (Button)this.findViewById(R.id.button_deactivate);
            mDeactivateButton.OnClickListener = new OnClickListenerAnonymousInnerClassHelper3(this);
        }
		protected internal override void onCreate(Bundle savedInstanceState)
		{
			base.onCreate(savedInstanceState);
			ContentView = R.layout.activity_sapa_simple_piano;

			try
			{
				(new Sapa()).initialize(this);
				mService = new SapaService();
				mService.start(SapaService.START_PARAM_DEFAULT_LATENCY);
				mProcessor = new SapaProcessor(this, null, new StatusListenerAnonymousInnerClassHelper(this));
				mService.register(mProcessor);

				// copy sound font file to sdcard.
				copyAssets();

				mProcessor.sendCommand("START");
				mProcessor.activate();

			}
			catch (SsdkUnsupportedException e)
			{
				Console.WriteLine(e.ToString());
				Console.Write(e.StackTrace);
				Toast.makeText(this, "Not support Professional Audio package", Toast.LENGTH_LONG).show();
				finish();
				return;
			}
			catch (System.ArgumentException e)
			{
				Console.WriteLine(e.ToString());
				Console.Write(e.StackTrace);
				Toast.makeText(this, "Error - invalid arguments. please check the log", Toast.LENGTH_LONG).show();
				finish();
				return;
			}
			catch (InstantiationException e)
			{
				Console.WriteLine(e.ToString());
				Console.Write(e.StackTrace);
				Toast.makeText(this, "Error. please check the log", Toast.LENGTH_LONG).show();
				finish();
				return;
			}

			((Button)findViewById(R.id.play_sound_c1)).OnClickListener = new OnClickListenerAnonymousInnerClassHelper(this);
		}
Exemplo n.º 8
0
        protected internal override void onCreate(Bundle savedInstanceState)
        {
            base.onCreate(savedInstanceState);
            ContentView = R.layout.activity_sapa_simple_piano;

            try
            {
                (new Sapa()).initialize(this);
                mService = new SapaService();
                mService.start(SapaService.START_PARAM_DEFAULT_LATENCY);
                mProcessor = new SapaProcessor(this, null, new StatusListenerAnonymousInnerClassHelper(this));
                mService.register(mProcessor);

                // copy sound font file to sdcard.
                copyAssets();

                mProcessor.sendCommand("START");
                mProcessor.activate();
            }
            catch (SsdkUnsupportedException e)
            {
                Console.WriteLine(e.ToString());
                Console.Write(e.StackTrace);
                Toast.makeText(this, "Not support Professional Audio package", Toast.LENGTH_LONG).show();
                finish();
                return;
            }
            catch (System.ArgumentException e)
            {
                Console.WriteLine(e.ToString());
                Console.Write(e.StackTrace);
                Toast.makeText(this, "Error - invalid arguments. please check the log", Toast.LENGTH_LONG).show();
                finish();
                return;
            }
            catch (InstantiationException e)
            {
                Console.WriteLine(e.ToString());
                Console.Write(e.StackTrace);
                Toast.makeText(this, "Error. please check the log", Toast.LENGTH_LONG).show();
                finish();
                return;
            }

            ((Button)findViewById(R.id.play_sound_c1)).OnClickListener = new OnClickListenerAnonymousInnerClassHelper(this);
        }
Exemplo n.º 9
0
        /// <summary>
        /// This method is responsible for starting native part of the standalone instance of
        /// application. This means registering the processor, registering ports and connecting to system
        /// audio ports.
        /// </summary>
        private void startSapaProcessor()
        {
            try
            {
                (new Sapa()).initialize(this);
                SapaService sapaService = new SapaService();
                if (!sapaService.Started)
                {
                    sapaService.start(SapaService.START_PARAM_DEFAULT_LATENCY);
                }
                // Creating processor for stand alone version.
                this.mProcessor = new SapaProcessor(this, null, new StatusListenerAnonymousInnerClassHelper(this));
                // The processor is being registered.
                sapaService.register(this.mProcessor);

                // The processor is being activated.
                this.mProcessor.activate();

                // Audio output ports are being connected to system input ports.
                connectPorts(sapaService);
            }
            catch (InstantiationException e)
            {
                Log.w(TAG, "SapaService was not created");
                Console.WriteLine(e.ToString());
                Console.Write(e.StackTrace);
            }
            catch (System.ArgumentException e)
            {
                // TODO Auto-generated catch block
                Console.WriteLine(e.ToString());
                Console.Write(e.StackTrace);
            }
            catch (SsdkUnsupportedException e)
            {
                // TODO Auto-generated catch block
                Console.WriteLine(e.ToString());
                Console.Write(e.StackTrace);
            }
        }
Exemplo n.º 10
0
        public override void onDestroy()
        {
            Log.d(TAG, "onDestroy");

            //Native part of application is being deactivated.
            if (mSapaService != null && mSapaProcessor != null)
            {
                mSapaProcessor.deactivate();
                mSapaService.unregister(mSapaProcessor);
                this.mSapaProcessor = null;
            }

            if (this.mSapaAppService != null)
            {
                try
                {
                    if (this.mMyInfo != null && this.mMyInfo.App != null)
                    {
                        //Application needs to declare that it was successfully deactivated.
                        this.mSapaAppService.removeFromActiveApps(this.mMyInfo.App);
                    }

                    //Action definer is being removed.
                    this.mSapaAppService.removeActionDefiner();
                }
                catch (SapaConnectionNotSetException e)
                {
                    Log.e(TAG, "Instance could not be removed from active list because of connection exception.");
                }
                //Connection with remote service is finished.
                this.mSapaAppService.disconnect();
                this.mSapaAppService = null;
            }

            this.mMyInfo = null;


            base.onDestroy();
        }
Exemplo n.º 11
0
 private void handleDeactivationIntent(Intent intent)
 {
     lock (this)
     {
         SapaApp sapaApp = SapaAppInfo.getApp(intent);
         this.mActionsList.Remove(sapaApp.InstanceId);
         SapaProcessor processor = this.mProcessorList[sapaApp.InstanceId];
         if (processor != null)
         {
             processor.deactivate();
             this.mSapaService.unregister(processor);
         }
         this.mProcessorList.Remove(sapaApp.InstanceId);
         try
         {
             this.mSapaAppService.removeFromActiveApps(sapaApp);
         }
         catch (SapaConnectionNotSetException e)
         {
             Log.e(TAG, "Instance could not be removed from active list because of connection exception.");
         }
         this.mAppInfoList.Remove(sapaApp.InstanceId);
     }
 }
Exemplo n.º 12
0
		public override void onServiceConnected()
		{
			Log.d(TAG, "onServiceConnected");
			try
			{
				if (this.mMyInfo == null)
				{
					mMyInfo = mSapaAppService.getInstalledApp(this.PackageName);
				}
				if (mMyInfo != null)
				{

					//Actions are being set in SapaAppInfo representing this application.
					mActionArray = new SparseArray<SapaActionInfo>();
					mActionArray.put(0, new SapaActionInfo(COMMAND_SHUSH, R.drawable.ctrl_btn_stop_default, PackageName));
					mMyInfo.Actions = mActionArray;

					//Native part is being initialised.
					Sapa sapa = new Sapa();
					sapa.initialize(this);
					mSapaService = new SapaService();
					mSapaProcessor = new SapaProcessor(this, null, new SapaProcessorStateListener(this, mMyInfo.App));
					mSapaService.register(mSapaProcessor);
					mSapaProcessor.activate();

					//Information about ports is being set in SapaAppInfo representing this app.
					//It can not be done before activating SapaProcessor.
					mMyInfo.PortFromSapaProcessor = mSapaProcessor;

					//Application needs to declare that it was successfully activated.
					if (mSapaAppService != null)
					{
						this.mSapaAppService.addActiveApp(this.mMyInfo);
					}
				}
			}
			catch (SapaConnectionNotSetException e)
			{
				Log.e(TAG, "App could not be added to active as connection has not been made.");
			}
			catch (System.ArgumentException e)
			{
				Log.e(TAG, "Initialisation of Sapa is not possible due to invalid context of application");
			}
			catch (SsdkUnsupportedException e)
			{
				Log.e(TAG, "Initialisation of Sapa is not possible as Sapa is not available on the device");
			}
			catch (InstantiationException e)
			{
				Log.e(TAG, "SapaService can not be instantiate");
			}
		}
Exemplo n.º 13
0
		private void handleActivationIntent(Intent intent)
		{
			// When application is activated from ProfessionalAudio system it
			// receives SapaAppInfo object describing it.
			// To obtain this object static method getSapaAppInfo() is to be used.
			SapaAppInfo info = SapaAppInfo.getAppInfo(intent);

			if (info != null)
			{
				string callerPackageName = intent.getStringExtra("com.samsung.android.sdk.professionalaudio.key.callerpackagename");
				if (callerPackageName == null)
				{
					callerPackageName = "unknown";
				}
				mCallerPackageNameList[info.App.InstanceId] = callerPackageName;
				Log.d(TAG, "info.getApp.getInstanceId() " + info.App.InstanceId);
				if (!this.mAppInfoList.ContainsKey(info.App.InstanceId))
				{
					this.mAppInfoList[info.App.InstanceId] = info;
				}
				try
				{
					// Actions are being set in SapaAppInfo representing this
					// application.
					mActionArray = new SparseArray<SapaActionInfo>();
					mActionArray.put(0, new SapaActionInfo(MainActivity.ACTION_PLAY, R.drawable.ctrl_btn_play_default, this.PackageName));
					mActionArray.put(1, new SapaActionInfo(MainActivity.ACTION_STOP, R.drawable.ctrl_btn_stop_default, this.PackageName, true, false));
					info.Actions = mActionArray;

					// Native part is being initialised.
					SapaProcessor sapaProcessor = new SapaProcessor(this, null, new SapaProcessorStateListener(this, info.App));
					this.mSapaService.register(sapaProcessor);
					sapaProcessor.activate();
					this.mProcessorList[info.App.InstanceId] = sapaProcessor;

					// Information about ports is being set in SapaAppInfo
					// representing this app.
					// It can not be done before activating SapaProcessor.
					info.PortFromSapaProcessor = sapaProcessor;

					// Application needs to declare that it was successfully
					// activated.
					Log.d(TAG, "addactiveapp " + info.App.InstanceId);
					this.mSapaAppService.addActiveApp(info);
				}
				catch (SapaConnectionNotSetException e)
				{
					Log.e(TAG, "App could not be added to active as connection has not been made.");

				}
				catch (InstantiationException e)
				{
					Log.e(TAG, "SapaService can not be instantiate...");
					Console.WriteLine(e.ToString());
					Console.Write(e.StackTrace);
				}
			}
			if (mActionsList != null && info != null && info.App != null)
			{
				this.mActionsList[info.App.InstanceId] = new ActionsPack(this, info.App);
			}
		}
Exemplo n.º 14
0
        private void handleActivationIntent(Intent intent)
        {
            // When application is activated from ProfessionalAudio system it
            // receives SapaAppInfo object describing it.
            // To obtain this object static method getSapaAppInfo() is to be used.
            SapaAppInfo info = SapaAppInfo.getAppInfo(intent);

            if (info != null)
            {
                string callerPackageName = intent.getStringExtra("com.samsung.android.sdk.professionalaudio.key.callerpackagename");
                if (callerPackageName == null)
                {
                    callerPackageName = "unknown";
                }
                mCallerPackageNameList[info.App.InstanceId] = callerPackageName;
                Log.d(TAG, "info.getApp.getInstanceId() " + info.App.InstanceId);
                if (!this.mAppInfoList.ContainsKey(info.App.InstanceId))
                {
                    this.mAppInfoList[info.App.InstanceId] = info;
                }
                try
                {
                    if (info.Configuration == null)
                    {
                        Log.d(TAG, "kaka, not exist configuration, volume[" + Logic.DEFAULT_VOLUME + "] will be set in " + info.App.InstanceId);
                        this.setConfiguration(info.App, Logic.DEFAULT_VOLUME);
                    }
                    else
                    {
                        Log.d(TAG, "kaka volume[" + info.Configuration.getInt("CONFIG") + "] was got from " + info.App.InstanceId);
                    }
                    // Actions are being set in SapaAppInfo representing this
                    // application.
                    mActionArray = new SparseArray <SapaActionInfo>();
                    mActionArray.put(0, new SapaActionInfo(MainActivity.VOLUME_DOWN, R.drawable.ctrl_btn_volume_down_default, this.PackageName));
                    mActionArray.put(1, new SapaActionInfo(MainActivity.VOLUME_UP, R.drawable.ctrl_btn_volume_up_default, this.PackageName));
                    info.Actions = mActionArray;

                    // Native part is being initialised.
                    SapaProcessor sapaProcessor = new SapaProcessor(this, null, new SapaProcessorStateListener(this, info.App));
                    this.mSapaService.register(sapaProcessor);
                    sapaProcessor.activate();
                    this.mProcessorList[info.App.InstanceId] = sapaProcessor;

                    Logic.sendVolume(sapaProcessor, this.getCurrectVolume(info.App));

                    // Information about ports is being set in SapaAppInfo
                    // representing this app.
                    // It can not be done before activating SapaProcessor.
                    info.PortFromSapaProcessor = sapaProcessor;

                    // Application needs to declare that it was successfully
                    // activated.
                    Log.d(TAG, "addactiveapp " + info.App.InstanceId);
                    this.mSapaAppService.addActiveApp(info);
                }
                catch (SapaConnectionNotSetException e)
                {
                    Log.e(TAG, "App could not be added to active as connection has not been made.");
                }
                catch (InstantiationException e)
                {
                    Log.e(TAG, "SapaService can not be instantiate");
                }
            }
            if (mActionsList != null && info != null && info.App != null)
            {
                this.mActionsList[info.App.InstanceId] = new ActionsPack(this, info.App);
            }
        }
Exemplo n.º 15
0
        private void handleActivationIntent(Intent intent)
        {
            // When application is activated from ProfessionalAudio system it
            // receives SapaAppInfo object describing it.
            // To obtain this object static method getSapaAppInfo() is to be used.
            SapaAppInfo info = SapaAppInfo.getAppInfo(intent);

            if (info != null)
            {
                string callerPackageName = intent.getStringExtra("com.samsung.android.sdk.professionalaudio.key.callerpackagename");
                if (callerPackageName == null)
                {
                    callerPackageName = "unknown";
                }
                mCallerPackageNameList[info.App.InstanceId] = callerPackageName;
                Log.d(TAG, "info.getApp.getInstanceId() " + info.App.InstanceId);
                if (!this.mAppInfoList.ContainsKey(info.App.InstanceId))
                {
                    this.mAppInfoList[info.App.InstanceId] = info;
                }
                try
                {
                    // Actions are being set in SapaAppInfo representing this
                    // application.
                    mActionArray = new SparseArray <SapaActionInfo>();
                    mActionArray.put(0, new SapaActionInfo(MainActivity.ACTION_PLAY, R.drawable.ctrl_btn_play_default, this.PackageName));
                    mActionArray.put(1, new SapaActionInfo(MainActivity.ACTION_STOP, R.drawable.ctrl_btn_stop_default, this.PackageName, true, false));
                    info.Actions = mActionArray;

                    // Native part is being initialised.
                    SapaProcessor sapaProcessor = new SapaProcessor(this, null, new SapaProcessorStateListener(this, info.App));
                    this.mSapaService.register(sapaProcessor);
                    sapaProcessor.activate();
                    this.mProcessorList[info.App.InstanceId] = sapaProcessor;

                    // Information about ports is being set in SapaAppInfo
                    // representing this app.
                    // It can not be done before activating SapaProcessor.
                    info.PortFromSapaProcessor = sapaProcessor;

                    // Application needs to declare that it was successfully
                    // activated.
                    Log.d(TAG, "addactiveapp " + info.App.InstanceId);
                    this.mSapaAppService.addActiveApp(info);
                }
                catch (SapaConnectionNotSetException e)
                {
                    Log.e(TAG, "App could not be added to active as connection has not been made.");
                }
                catch (InstantiationException e)
                {
                    Log.e(TAG, "SapaService can not be instantiate...");
                    Console.WriteLine(e.ToString());
                    Console.Write(e.StackTrace);
                }
            }
            if (mActionsList != null && info != null && info.App != null)
            {
                this.mActionsList[info.App.InstanceId] = new ActionsPack(this, info.App);
            }
        }
Exemplo n.º 16
0
		public override void onDestroy()
		{
			Log.d(TAG, "onDestroy");

			//Native part of application is being deactivated.
			if (mSapaService != null && mSapaProcessor != null)
			{
				mSapaProcessor.deactivate();
				mSapaService.unregister(mSapaProcessor);
				this.mSapaProcessor = null;
			}

			if (this.mSapaAppService != null)
			{
				try
				{
					if (this.mMyInfo != null && this.mMyInfo.App != null)
					{
					//Application needs to declare that it was successfully deactivated.
					this.mSapaAppService.removeFromActiveApps(this.mMyInfo.App);
					}

					//Action definer is being removed.
					this.mSapaAppService.removeActionDefiner();
				}
				catch (SapaConnectionNotSetException e)
				{
					Log.e(TAG, "Instance could not be removed from active list because of connection exception.");
				}
				//Connection with remote service is finished.
				this.mSapaAppService.disconnect();
				this.mSapaAppService = null;
			}

			this.mMyInfo = null;


			base.onDestroy();
		}
		protected internal override void onDestroy()
		{
			base.onDestroy();
			if (mService != null)
			{
				if (mProcessor != null)
				{
					mService.unregister(mProcessor);
					mProcessor = null;
				}
				mService.stop(false);
			}
		}
Exemplo n.º 18
0
		/// <summary>
		/// This method is responsible for starting native part of the standalone instance of
		/// application. This means registering the processor, registering ports and connecting to system
		/// audio ports.
		/// </summary>
		private void startSapaProcessor()
		{
			try
			{
				(new Sapa()).initialize(this);
				SapaService sapaService = new SapaService();
				if (!sapaService.Started)
				{
					sapaService.start(SapaService.START_PARAM_DEFAULT_LATENCY);
				}
				// Creating processor for stand alone version.
				this.mProcessor = new SapaProcessor(this, null, new StatusListenerAnonymousInnerClassHelper(this));
				// The processor is being registered.
				sapaService.register(this.mProcessor);

				// The processor is being activated.
				this.mProcessor.activate();

				// Audio output ports are being connected to system input ports.
				connectPorts(sapaService);

			}
			catch (InstantiationException e)
			{
				Log.w(TAG, "SapaService was not created");
				Console.WriteLine(e.ToString());
				Console.Write(e.StackTrace);
			}
			catch (System.ArgumentException e)
			{
				// TODO Auto-generated catch block
				Console.WriteLine(e.ToString());
				Console.Write(e.StackTrace);
			}
			catch (SsdkUnsupportedException e)
			{
				// TODO Auto-generated catch block
				Console.WriteLine(e.ToString());
				Console.Write(e.StackTrace);
			}
		}