Esempio n. 1
0
        public void FormMixer_MuteButtonClick(Object sender, EventArgs e)
        {
            VolumeTracker parent = (VolumeTracker)sender;
            int           track  = parent.getTrack();

            try {
                invokeMuteChangedEvent(track, parent.isMuted());
            } catch (Exception ex) {
                Logger.write(typeof(FormMixer) + ".FormMixer_MuteButtonClick; ex=" + ex + "\n");
                serr.println("FormMixer#FormMixer_IsMutedChanged; ex=" + ex);
            }
            updateSoloMute();
        }
Esempio n. 2
0
        /// <summary>
        /// ボリューム用のイベントハンドラを再登録します
        /// </summary>
        private void reregisterEventHandlers()
        {
            int size = 0;

            if (m_tracker != null)
            {
                size = m_tracker.Count;
            }
            for (int i = 0; i < size; i++)
            {
                VolumeTracker item = m_tracker[i];
                item.PanpotChanged   += new PanpotChangedEventHandler(FormMixer_PanpotChanged);
                item.FederChanged    += new FederChangedEventHandler(FormMixer_FederChanged);
                item.MuteButtonClick += new EventHandler(FormMixer_MuteButtonClick);
                item.SoloButtonClick += new EventHandler(FormMixer_SoloButtonClick);
            }
            volumeMaster.PanpotChanged   += new PanpotChangedEventHandler(volumeMaster_PanpotChanged);
            volumeMaster.FederChanged    += new FederChangedEventHandler(volumeMaster_FederChanged);
            volumeMaster.MuteButtonClick += new EventHandler(volumeMaster_MuteButtonClick);
        }
Esempio n. 3
0
 private void addToPanelSlaves(VolumeTracker item, int ix)
 {
     panelSlaves.Controls.Add(item);
 }
Esempio n. 4
0
        /// <summary>
        /// 現在のシーケンスの状態に応じて,ミキサーウィンドウの状態を更新します
        /// </summary>
        public void updateStatus()
        {
            VsqFileEx vsq = AppManager.getVsqFile();
            int       num = vsq.Mixer.Slave.Count + AppManager.getBgmCount();

            if (m_tracker == null)
            {
                m_tracker = new List <VolumeTracker>();
            }

            // イベントハンドラをいったん解除する
            unregisterEventHandlers();

            // trackerの総数が変化したかどうか
            bool num_changed = (m_tracker.Count != num);

            // trackerに過不足があれば数を調節
            if (m_tracker.Count < num)
            {
                int remain = num - m_tracker.Count;
                for (int i = 0; i < remain; i++)
                {
                    VolumeTracker item = new VolumeTracker();
                    item.BorderStyle = BorderStyle.FixedSingle;
                    item.Size        = volumeMaster.Size;
                    m_tracker.Add(item);
                }
            }
            else if (m_tracker.Count > num)
            {
                int delete = m_tracker.Count - num;
                for (int i = 0; i < delete; i++)
                {
                    int           indx = m_tracker.Count - 1;
                    VolumeTracker tr   = m_tracker[indx];
                    m_tracker.RemoveAt(indx);
                    tr.Dispose();
                }
            }

            // 同時に表示できるVolumeTrackerの個数を計算
            int max              = PortUtil.getWorkingArea(this).width;
            int bordersize       = 4;// TODO: ここもともとは SystemInformation.FrameBorderSize;だった
            int max_client_width = max - 2 * bordersize;
            int max_num          = (int)Math.Floor(max_client_width / (VolumeTracker.WIDTH + 1.0f));

            num++;

            int screen_num = num <= max_num ? num : max_num; //スクリーン上に表示するVolumeTrackerの個数

            // panelSlaves上に配置するVolumeTrackerの個数
            int num_vtracker_on_panel = vsq.Mixer.Slave.Count + AppManager.getBgmCount();
            // panelSlaves上に一度に表示可能なVolumeTrackerの個数
            int panel_capacity = max_num - 1;

            if (panel_capacity >= num_vtracker_on_panel)
            {
                // volumeMaster以外の全てのVolumeTrackerを,画面上に同時表示可能
                hScroll.Minimum     = 0;
                hScroll.Value       = 0;
                hScroll.Maximum     = 0;
                hScroll.LargeChange = 1;
                hScroll.Size        = new Size((VolumeTracker.WIDTH + 1) * num_vtracker_on_panel, 15);
            }
            else
            {
                // num_vtracker_on_panel個のVolumeTrackerのうち,panel_capacity個しか,画面上に同時表示できない
                hScroll.Minimum     = 0;
                hScroll.Value       = 0;
                hScroll.Maximum     = num_vtracker_on_panel * VolumeTracker.WIDTH;
                hScroll.LargeChange = panel_capacity * VolumeTracker.WIDTH;
                hScroll.Size        = new Size((VolumeTracker.WIDTH + 1) * panel_capacity, 15);
            }
            hScroll.Location = new System.Drawing.Point(0, VolumeTracker.HEIGHT);

            int j = -1;

            foreach (var vme in vsq.Mixer.Slave)
            {
                j++;
#if DEBUG
                sout.println("FormMixer#updateStatus; #" + j + "; feder=" + vme.Feder + "; panpot=" + vme.Panpot);
#endif
                VolumeTracker tracker = m_tracker[j];
                tracker.setFeder(vme.Feder);
                tracker.setPanpot(vme.Panpot);
                tracker.setTitle(vsq.Track[j + 1].getName());
                tracker.setNumber((j + 1) + "");
                tracker.setLocation(j * (VolumeTracker.WIDTH + 1), 0);
                tracker.setSoloButtonVisible(true);
                tracker.setMuted((vme.Mute == 1));
                tracker.setSolo((vme.Solo == 1));
                tracker.setTrack(j + 1);
                tracker.setSoloButtonVisible(true);
                addToPanelSlaves(tracker, j);
            }
            int count = AppManager.getBgmCount();
            for (int i = 0; i < count; i++)
            {
                j++;
                BgmFile       item    = AppManager.getBgm(i);
                VolumeTracker tracker = m_tracker[j];
                tracker.setFeder(item.feder);
                tracker.setPanpot(item.panpot);
                tracker.setTitle(PortUtil.getFileName(item.file));
                tracker.setNumber("");
                tracker.setLocation(j * (VolumeTracker.WIDTH + 1), 0);
                tracker.setSoloButtonVisible(false);
                tracker.setMuted((item.mute == 1));
                tracker.setSolo(false);
                tracker.setTrack(-i - 1);
                tracker.setSoloButtonVisible(false);
                addToPanelSlaves(tracker, j);
            }
#if DEBUG
            sout.println("FormMixer#updateStatus; vsq.Mixer.MasterFeder=" + vsq.Mixer.MasterFeder);
#endif
            volumeMaster.setFeder(vsq.Mixer.MasterFeder);
            volumeMaster.setPanpot(vsq.Mixer.MasterPanpot);
            volumeMaster.setSoloButtonVisible(false);

            updateSoloMute();

            // イベントハンドラを再登録
            reregisterEventHandlers();

            // ウィンドウのサイズを更新(必要なら)
            if (num_changed)
            {
                panelSlaves.Width     = (VolumeTracker.WIDTH + 1) * (screen_num - 1);
                volumeMaster.Location = new System.Drawing.Point((screen_num - 1) * (VolumeTracker.WIDTH + 1) + 3, 0);
                this.MaximumSize      = Size.Empty;
                this.MinimumSize      = Size.Empty;
                this.ClientSize       = new Size(screen_num * (VolumeTracker.WIDTH + 1) + 3, VolumeTracker.HEIGHT + hScroll.Height);
                this.MinimumSize      = this.Size;
                this.MaximumSize      = this.Size;
                this.Invalidate();
                //m_parent.requestFocusInWindow(); // <-要る?
            }
        }