Exemple #1
0
        public SoundResource(ResourceManager mgr, string fullName, Stream stream, Format fmt)
        {
            _manager = mgr;
            FullName = fullName;

            switch (fmt)
            {
                case Format.MP3:
                {
                    Mp3FileReader mp3 = new Mp3FileReader(stream);
                    _reader = mp3;
                    break;
                }
                case Format.WAV:
                {
                    WaveFileReader wav = new WaveFileReader(stream);
                    _reader = wav;
                    break;
                }
                default:
                    throw new InvalidOperationException("Unsupported extension.");
            }

            _stream = new WaveChannel32(_reader);
            _stream.PadWithZeroes = false;

            _wavDevice.PlaybackStopped += _wavDevice_PlaybackStopped;
        }
Exemple #2
0
        static void Main(string[] args)
        {
            var mgr = new ResourceManager();
            mgr.LoadLibrary(Environment.CurrentDirectory + "\\..\\..\\test.assl");

            mgr.Start();

            var res = mgr.GetResource("chord");

            Console.ReadLine();
            mgr.Stop();
        }
Exemple #3
0
        void giver()
        {
            ResourceManager manager = new ResourceManager();
            manager.LoadLibrary(@"E:\Media");

            EventSchedule sched = new EventSchedule(32);
            sched.TicksPerSec = 1;

            //BasicEvent.Provider prov = new BasicEvent.Provider();
            SoundEvent.Provider prov1 = new SoundEvent.Provider("Chord", manager, "chord.wav");
            SoundEvent.Provider prov2 = new SoundEvent.Provider("Ding", manager, "ding.wav");
            /*RandomEventSelector rnd = new RandomEventSelector();
            rnd.Selection.Add(prov1);
            rnd.Selection.Add(prov2);
            SimultaneousEventProvider sim = new SimultaneousEventProvider();
            sim.Group.Add(prov1);
            sim.Group.Add(prov2);
            PeriodicEventProvider per = new PeriodicEventProvider();
            per.Period = 8;
            per.Variance = 0;
            per.Subordinate = sim;
             */

            _hub.SetChannel(this);
            _hub.Initialize(_this);

            var obs = new EventProviderActivator(AppID);
            obs.Provider = prov1;
            obs.Schedule = sched;
            var id = new TriggerID("Test", 1);
            bool result = _hub.Hub.ConnectObserver(id, obs);

            //sched.Model.Add(per);
            sched.Tick += new EventSchedule.TimeEvent(Ticker);
            sched.Start(false);

            //AutoResetEvent auto = new AutoResetEvent(false);
            //while (sched.IsRunning)
            //    auto.WaitOne(1000);

            Console.Write("Press any key...");
            Console.ReadLine();

            sched.Stop();
            _hub.Finish(_this);

            Console.WriteLine("Finished.");
            Console.ReadLine();

            return;
        }
Exemple #4
0
        public Form1()
        {
            InitializeComponent();

            _manager = new ResourceManager();
            ILibrary lib = _manager.LoadLibrary(@"E:\Media");
            _manager.Start();
            libraryView1.Resources = _manager;

            _sched = new EventSchedule(32);
            _sched.TicksPerSec = 2;

            BasicEvent.Provider prov1 = new BasicEvent.Provider("Chord");
            BasicEvent.Provider prov2 = new BasicEvent.Provider("Ding");
            snd3 = new SoundEvent.Provider("Sound1", _manager, "Media::sttng.wav");
            //SoundEvent.Provider prov1 = new SoundEvent.Provider("Chord", _manager, "chord.wav");
            //SoundEvent.Provider prov2 = new SoundEvent.Provider("Ding", _manager, "krkfunny.WAV");
            PeriodicEventProvider per1 = new PeriodicEventProvider("Period");
            //SimultaneousEventProvider sim2 = new SimultaneousEventProvider("Simul");
            _randEventSel.Selection.Add(prov1);
            _randEventSel.Selection.Add(prov2);

            //sim2.Group.Add(prov1);
            //sim2.Group.Add(prov2);

            per1.Subordinate = prov1;
            per1.Period = 4;

            per2.Subordinate = prov2;
            per2.Period = 5;

            del1.Subordinate = prov2;
            del1.Delay = 5;

            _colors[per1] = Color.Red;
            _colors[prov2] = Color.Orange;
            _colors[prov1] = Color.Green;

            _sched.Initialize();
            _sched.AddProvider(prov2);
            _sched.AddProvider(per1);
            //_sched.AddProvider(del1);
            _sched.AddProvider(per2);
            //_sched.AddProvider(prov2);

            scheduleView1.ColorProvider = this;
            scheduleView1.Schedule = _sched;
            scheduleView1.TokenMouseEnter += new ScheduleView.TokenMouseEvent(scheduleView1_TokenMouseEnter);
            scheduleView1.TokenMouseLeave += new ScheduleView.TokenMouseEvent(scheduleView1_TokenMouseLeave);
            scheduleView1.LeftColumnChanged += new ScheduleView.ViewValueChangeEvent(scheduleView1_LeftColumnChanged);
            scheduleView1.TopRowChanged += new ScheduleView.ViewValueChangeEvent(scheduleView1_TopRowChanged);

            eventTokenTile1.Token = new ProviderToken(prov1, this);

            providerTokenList1.AllowItemDrag = false;
            providerTokenList1.Items.Add(prov1);
            providerTokenList1.Items.Add(prov2);

            eventTokenTile2.MouseMove += new MouseEventHandler(eventTokenTile2_MouseMove);
            eventTokenTile2.MouseLeave += new EventHandler(eventTokenTile2_MouseLeave);
            eventTokenTile2.MouseUp += new MouseEventHandler(eventTokenTile2_MouseLeave);

            providerTokenButton1.TileClicked += new ProviderTokenButton.TileClickedEvent(providerTokenButton1_TileClicked);

            libraryView1.SelectionChanged += new LibraryView.ResourceEventHandler(libraryView1_SelectionChanged);

            this.Load += new EventHandler(Form1_Load);
            this.FormClosed += new FormClosedEventHandler(Form1_FormClosed);
        }