public override void onServiceConnected() { Log.d(TAG, "onServiceConnected"); try { Sapa sapa = new Sapa(); sapa.initialize(this); this.mSapaService = new SapaService(); this.mServiceConnected = true; } 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"); } if (this.mServiceConnected) { while (mDelayedIntents.Count > 0) { Intent intent = mDelayedIntents.RemoveFirst(); if (intent != null) { handleIntent(intent); } } } }
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"); } }
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); }
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_plugin_simple_client; try { Sapa sapa = new Sapa(); sapa.initialize(this); mService = new SapaService(); mService.start(SapaService.START_PARAM_DEFAULT_LATENCY); } catch (SsdkUnsupportedException e) { Toast.makeText(this, "Not support professional audio package", Toast.LENGTH_LONG).show(); Console.WriteLine(e.ToString()); Console.Write(e.StackTrace); finish(); return; } catch (InstantiationException e) { Toast.makeText(this, "fail to instantiation SapaService", Toast.LENGTH_LONG).show(); Console.WriteLine(e.ToString()); Console.Write(e.StackTrace); finish(); return; } ((Button) findViewById(R.id.load_button)).Enabled = true; ((Button) findViewById(R.id.load_button)).OnClickListener = new OnClickListenerAnonymousInnerClassHelper(this, e); ((Button) findViewById(R.id.activate_button)).Enabled = false; ((Button) findViewById(R.id.activate_button)).OnClickListener = new OnClickListenerAnonymousInnerClassHelper2(this); }
protected internal override void onCreate(Bundle savedInstanceState) { base.onCreate(savedInstanceState); ContentView = R.layout.activity_sapa_plugin_simple_client; try { Sapa sapa = new Sapa(); sapa.initialize(this); mService = new SapaService(); mService.start(SapaService.START_PARAM_DEFAULT_LATENCY); } catch (SsdkUnsupportedException e) { Toast.makeText(this, "Not support professional audio package", Toast.LENGTH_LONG).show(); Console.WriteLine(e.ToString()); Console.Write(e.StackTrace); finish(); return; } catch (InstantiationException e) { Toast.makeText(this, "fail to instantiation SapaService", Toast.LENGTH_LONG).show(); Console.WriteLine(e.ToString()); Console.Write(e.StackTrace); finish(); return; } ((Button)findViewById(R.id.load_button)).Enabled = true; ((Button)findViewById(R.id.load_button)).OnClickListener = new OnClickListenerAnonymousInnerClassHelper(this, e); ((Button)findViewById(R.id.activate_button)).Enabled = false; ((Button)findViewById(R.id.activate_button)).OnClickListener = new OnClickListenerAnonymousInnerClassHelper2(this); }
public override void onCreate(Bundle savedInstanceState) { base.onCreate(savedInstanceState); ContentView = R.layout.activity_main; List <string> availableList = new List <string>(); try { Sapa sapa = new Sapa(); sapa.initialize(this); mService = new SapaService(); availableList.Add("Default"); if (sapa.isFeatureEnabled(Sapa.SUPPORT_HIGH_LATENCY)) { availableList.Add("High"); } if (sapa.isFeatureEnabled(Sapa.SUPPORT_MID_LATENCY)) { availableList.Add("Mid"); } if (sapa.isFeatureEnabled(Sapa.SUPPORT_LOW_LATENCY)) { availableList.Add("Low"); } } catch (SsdkUnsupportedException e1) { Console.WriteLine(e1.ToString()); Console.Write(e1.StackTrace); Toast.makeText(this, "Not support Professional Audio package", Toast.LENGTH_LONG).show(); finish(); return; } catch (InstantiationException e) { Console.WriteLine(e.ToString()); Console.Write(e.StackTrace); Toast.makeText(this, "Fail to create", Toast.LENGTH_LONG).show(); finish(); return; } mSyncStart = (Button)this.findViewById(R.id.sync_start); mSyncStart.OnClickListener = new OnClickListenerAnonymousInnerClassHelper(this); mSyncStop = (Button)this.findViewById(R.id.sync_stop); mSyncStop.OnClickListener = new OnClickListenerAnonymousInnerClassHelper2(this); mSetPosition = (Button)this.findViewById(R.id.set_position); mSetPosition.OnClickListener = new OnClickListenerAnonymousInnerClassHelper3(this); mButtonCon = (Button)findViewById(R.id.connect_button); mButtonCon.OnClickListener = new OnClickListenerAnonymousInnerClassHelper4(this, e); mButtonDisconnAll = (Button)findViewById(R.id.disconn_button); mButtonDisconnAll.OnClickListener = new OnClickListenerAnonymousInnerClassHelper5(this); mOnOffButton = (ToggleButton)findViewById(R.id.service_button); mOnOffButton.OnClickListener = new OnClickListenerAnonymousInnerClassHelper(this, e); mButtonAudio = (Button)findViewById(R.id.audio_tab_button); mButtonAudio.OnClickListener = new OnClickListenerAnonymousInnerClassHelper6(this); mButtonMidi = (Button)findViewById(R.id.midi_tab_button); mButtonMidi.OnClickListener = new OnClickListenerAnonymousInnerClassHelper7(this); mInputText = (TextView)findViewById(R.id.inputport_text); mOutputText = (TextView)findViewById(R.id.outputport_text); mInputPortList = (ListView)findViewById(R.id.inputPort_listView); mInputPortList.OnItemClickListener = new OnItemClickListenerAnonymousInnerClassHelper(this); mOutputPortList = (ListView)findViewById(R.id.outputPort_listView); mOutputPortList.OnItemClickListener = new OnItemClickListenerAnonymousInnerClassHelper2(this); mConnected = (ListView)findViewById(R.id.connected_ListView); mConnected.OnItemClickListener = new OnItemClickListenerAnonymousInnerClassHelper3(this); mGetConn = (Button)findViewById(R.id.getconn_button); mGetConn.OnClickListener = new OnClickListenerAnonymousInnerClassHelper8(this); TextView tv = new TextView(ApplicationContext); tv.TextSize = 20; tv.Text = "Input Port List"; mInputPortList.addHeaderView(tv); TextView tv1 = new TextView(ApplicationContext); tv1.TextSize = 20; tv1.Text = "OutPut Port List"; mOutputPortList.addHeaderView(tv1); TextView tv2 = new TextView(ApplicationContext); tv2.TextSize = 20; tv2.Text = "Connected Port List"; mConnected.addHeaderView(tv2); mInputPortList.Adapter = null; mOutputPortList.Adapter = null; mConnected.Adapter = null; if (mService.Started == true) { mOnOffButton.Checked = true; } else { mOnOffButton.Checked = false; } spinner = (Spinner)findViewById(R.id.latency_spinner); string[] items = new string[availableList.Count]; availableList.toArray(items); ArrayAdapter <string> spinnerArrayAdapter = new ArrayAdapter <string>(this, android.R.layout.simple_spinner_dropdown_item, items); spinner.OnItemSelectedListener = this; spinner.Adapter = spinnerArrayAdapter; }
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"); } }