Пример #1
0
 private void AddSoundEvent(NoiseChannelEvents soundEvent, int value, int channelIndex = 0xFF)
 {
     if (channelIndex == 0xFF)
     {
         channelIndex = _channelIndex;
     }
     _soundEventQueue.AddSoundEvent(_state.TickDiff, (int)soundEvent, value, channelIndex);
     _state.TickDiff = 0;
 }
Пример #2
0
        public void WriteOutput()
        {
            try
            {
                using (var file = new StreamWriter("sound_events.csv", false))
                {
                    file.WriteLine("{0},{1},{2}", "Ms", "Event", "Value");
                    for (uint i = 0; i < TimelineLocalCount; i += 3)
                    {
                        //file.WriteLine("{0},{1},{2}",
                        //               Timeline[i],
                        //               //"0x" + Timeline[i + 1].ToString("x2").ToUpper());
                        //               Timeline[i + 1],
                        //               Timeline[i + 2]);
                        NoiseChannelEvents soundEvent = (NoiseChannelEvents)TimelineLocal[i + 1];
                        long   soundEventValue        = TimelineLocal[i + 2];
                        string value;
                        if (soundEvent == NoiseChannelEvents.VOLUME_CHANGE)
                        {
                            value = soundEventValue.ToString();
                        }
                        else if (soundEvent == NoiseChannelEvents.ENABLED_CHANGE)
                        {
                            if (soundEventValue == 1)
                            {
                                value = "ON";
                            }
                            else
                            {
                                value = String.Format("OFF");
                            }
                        }
                        else if ((soundEvent == NoiseChannelEvents.LSFR_CHANGE) ||
                                 (soundEvent == NoiseChannelEvents.LSFR_CHANGE2) ||
                                 (soundEvent == NoiseChannelEvents.LSFR_CHANGE3))
                        {
                            value = Convert.ToString(soundEventValue, 2);
                        }
                        else
                        {
                            value = "0x" + soundEventValue.ToString("x2");
                        }

                        file.WriteLine("{0},{1},{2}", TimelineLocal[i],
                                       soundEvent,
                                       value);
                    }
                }
            }
            catch (IOException)
            {
                // Probably because the csv is opened by a program. Whatever...
            }
        }
Пример #3
0
 private void AddSoundEvent(NoiseChannelEvents soundEvent, int value, int channelIndex = 0xFF)
 {
     if (channelIndex == 0xFF) { channelIndex = _channelIndex; }
       _soundEventQueue.AddSoundEvent(_state.TickDiff, (int)soundEvent, value, channelIndex);
       _state.TickDiff = 0;
 }