-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMainActivity.cs
38 lines (31 loc) · 1.07 KB
/
MainActivity.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using Android.App;
using Android.Widget;
using Android.OS;
namespace ManagedBass.Sample.Android
{
[Activity (Label = "ManagedBass.Sample.Android", MainLauncher = true)]
public class MainActivity : Activity
{
readonly SineWave _sineWave = new SineWave(20, 20, 40, 100);
protected override void OnCreate (Bundle SavedInstanceState)
{
base.OnCreate (SavedInstanceState);
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.Main);
var controller = FindViewById<Button>(Resource.Id.controller);
controller.Click += (sender, e) =>
{
if (Bass.ChannelIsActive(_sineWave.Handle) == PlaybackState.Playing)
{
Bass.ChannelStop(_sineWave.Handle);
controller.Text = "Start SineWave";
}
else
{
Bass.ChannelPlay(_sineWave.Handle);
controller.Text = "Stop";
}
};
}
}
}