コード例 #1
0
ファイル: Runtime.cs プロジェクト: leezer3/openbve-1
 // --- constructors ---
 /// <summary>Creates a new instance of this class.</summary>
 /// <param name="pluginFolder">The absolute path to the plugin folder.</param>
 /// <param name="trainFolder">The absolute path to the train folder.</param>
 /// <param name="playSound">The callback function for playing sounds.</param>
 public LoadProperties(string pluginFolder, string trainFolder, PlaySoundDelegate playSound)
 {
     this.MyPluginFolder  = pluginFolder;
     this.MyTrainFolder   = trainFolder;
     this.MyPlaySound     = playSound;
     this.MyFailureReason = null;
 }
コード例 #2
0
ファイル: Sounds.cs プロジェクト: s520/MiscFunc_For_OpenBVE
        // --- コンストラクタ ---
        /// <summary>新しいインスタンスを作成する</summary>
        /// <param name="playSound">サウンドを再生する関数のデリゲート。</param>
        internal Sounds(PlaySoundDelegate playSound)
        {
            this.PlaySound = playSound;

            // --- 繰り返し再生 ---
            this.Eb            = new Sounds.Sound(13);
            this.LoopingSounds = new Sound[] { this.Eb };

            // --- 1回再生 ---
            this.WiperSwDownSound = new Sound(6);
            this.LcdSwDownSound   = new Sound(61);
            this.LcdSwUpSound     = new Sound(62);
            this.LightSwDownSound = new Sound(63);
            this.LightSwUpSound   = new Sound(64);
            if (LoadConfig.WiperWet == 0)
            {
                this.WiperSound = new Sound(17);
            }
            else
            {
                this.WiperSound = new Sound(18);
            }
            this.SwitchSound = new Sound[LoadSwitch.ALL_SWITCH];
            for (int i = 0; i < LoadSwitch.switch_config_.Length; i++)
            {
                this.SwitchSound[i] = new Sound(LoadSwitch.switch_config_[i].switch_index_);
            }
            this.PlayOnceSounds = new List <Sound> {
                this.WiperSwDownSound, this.LcdSwDownSound, this.WiperSound
            };
            for (int i = 0; i < LoadSwitch.ALL_SWITCH; i++)
            {
                this.PlayOnceSounds.Add(this.SwitchSound[i]);
            }
        }
コード例 #3
0
        // --- コンストラクタ ---
        /// <summary>新しいインスタンスを作成する</summary>
        /// <param name="playSound">サウンドを再生する関数のデリゲート。</param>
        internal Sounds(PlaySoundDelegate playSound)
        {
            this.PlaySound = playSound;

            // --- 繰り返し再生 ---
            this.Eb            = new Sounds.Sound(13);
            this.LoopingSounds = new Sound[] { this.Eb };

            // --- 1回再生 ---
            this.AtspDing         = new Sound(2);
            this.AtcDing          = new Sound(7);
            this.AtcSwDownSound   = new Sound(8);
            this.AtcSwUpSound     = new Sound(9);
            this.WiperSwDownSound = new Sound(6);
            this.LcdSwDownSound   = new Sound(61);
            this.AtcAirSound      = new Sound(10);
            if (LoadConfig.WiperWet == 0)
            {
                this.WiperSound = new Sound(17);
            }
            else
            {
                this.WiperSound = new Sound(18);
            }
            this.PlayOnceSounds = new Sound[] { this.AtspDing, this.AtcDing, this.AtcSwDownSound, this.AtcSwUpSound, this.WiperSwDownSound, this.LcdSwDownSound, this.AtcAirSound, this.WiperSound };
        }
コード例 #4
0
 // constructors
 /// <summary>Creates a new instance of this class.</summary>
 /// <param name="playSound">The callback function for playing sounds.</param>
 /// <param name="count">The amount of sound instructions to use. This is 256 in Win32 plugins but can be a different value if needed.</param>
 internal SoundHelper(PlaySoundDelegate playSound, int count)
 {
     this.Sound     = new int[count];
     this.LastSound = new int[count];
     this.Handles   = new SoundHandle[count];
     this.PlaySound = playSound;
 }
コード例 #5
0
 // --- constructors ---
 /// <summary>Creates a new instance of this class.</summary>
 /// <param name="pluginFolder">The absolute path to the plugin folder.</param>
 /// <param name="trainFolder">The absolute path to the train folder.</param>
 /// <param name="playSound">The callback function for playing sounds.</param>
 /// /// <param name="addMessage">The callback function for adding interface messages.</param>
 public LoadProperties(string pluginFolder, string trainFolder, PlaySoundDelegate playSound, AddInterfaceMessageDelegate addMessage)
 {
     this.MyPluginFolder        = pluginFolder;
     this.MyTrainFolder         = trainFolder;
     this.MyPlaySound           = playSound;
     this.MyAddInterfaceMessage = addMessage;
     this.MyFailureReason       = null;
 }
コード例 #6
0
 public TrainSoundManager(PlaySoundDelegate playSound)
 {
     this.playSound = playSound;
     loopSounds = new List<LoopSound>();
     loopSoundsFor = new List<LoopSoundFor>();
     lastSoundTime = new Time(0);
     lastSoundIndex = SoundIndex.None;
 }
コード例 #7
0
        // constructors

        /// <summary>Initialises the sound manager. Call this method via the Load() method.</summary>
        /// <param name="playSound">The callback function for playing sounds.</param>
        /// <param name="numIndices">The number of sound indices to accomodate.</param>
        internal static void Initialise(PlaySoundDelegate playSound, int numIndices)
        {
            SoundHandles = new SoundHandle[numIndices];
            IsLooped     = new bool[numIndices];
            LastVolume   = new double[numIndices];
            LastPitch    = new double[numIndices];
            PlaySound    = playSound;
        }
コード例 #8
0
 public bool Load(LoadProperties properties)
 {
     properties.Panel = new int[256];
     panel            = properties.Panel;
     SoundDelegate    = properties.PlaySound;
     ATSPlugin.Cpp.Load();
     ATSPlugin.Cpp.GetPluginVersion();
     return(true);
 }
コード例 #9
0
ファイル: Train.cs プロジェクト: joeyfoo/SgATC
        internal Train(int[] panel, PlaySoundDelegate playSound)
        {
            this.panel = panel;

            devices.Add("internlock", new Interlock(this));
            devices.Add("modeselector", new ModeSelector(this));
            //devices.Add("rm", new Mode_RM(this));
            devices.Add("ato", new Mode_ATO(this));
            devices.Add("atp", new ATP(this));
        }
コード例 #10
0
ファイル: Train.cs プロジェクト: sladen/openbve
 // --- constructors ---
 /// <summary>Creates a new train without any devices installed.</summary>
 /// <param name="panel">The array of panel variables.</param>
 /// <param name="playSound">The delegate to play sounds.</param>
 internal Train(int[] panel, PlaySoundDelegate playSound)
 {
     this.PluginInitializing = false;
     this.Specs = new VehicleSpecs(0, BrakeTypes.ElectromagneticStraightAirBrake, 0, false, 0);
     this.State = new VehicleState(0.0, new Speed(0.0), 0.0, 0.0, 0.0, 0.0, 0.0);
     this.Handles = new ReadOnlyHandles(new Handles(0, 0, 0, false));
     this.Doors = DoorStates.None;
     this.Panel = panel;
     this.Sounds = new Sounds(playSound);
     this.AI = new AI(this);
 }
コード例 #11
0
 // --- constructors ---
 /// <summary>Creates a new train without any devices installed.</summary>
 /// <param name="panel">The array of panel variables.</param>
 /// <param name="playSound">The delegate to play sounds.</param>
 internal Train(int[] panel, PlaySoundDelegate playSound)
 {
     this.PluginInitializing = false;
     this.Specs   = new VehicleSpecs(0, BrakeTypes.ElectromagneticStraightAirBrake, 0, false, 0);
     this.State   = new VehicleState(0.0, new Speed(0.0), 0.0, 0.0, 0.0, 0.0, 0.0);
     this.Handles = new ReadOnlyHandles(new Handles(0, 0, 0, false));
     this.Doors   = DoorStates.None;
     this.Panel   = panel;
     this.Sounds  = new Sounds(playSound);
     this.AI      = new AI(this);
 }
コード例 #12
0
        internal Train(int[] panel, PlaySoundDelegate playSound)
        {
            this.panel = panel;

            devices.Add("interlock", new Interlock(this));
            devices.Add("modeselector", new ModeSelector(this));
            devices.Add("rm", new Mode_RM(this));
            devices.Add("ato", new Mode_ATO(this));
            devices.Add("atp", new ATP(this));

            PlaySound = playSound;
        }
コード例 #13
0
ファイル: Sounds.cs プロジェクト: JakubVanek/openBVE-1
		// --- constructors ---
		
		/// <summary>Creates a new instance of sounds.</summary>
		/// <param name="playSound">The delegate to the function to play sounds.</param>
		internal Sounds(PlaySoundDelegate playSound) {
			this.PlaySound = playSound;
			// --- looping ---
			this.AtsBell = new Sound(0);
			this.AtsChime = new Sound(1);
			this.Eb = new Sounds.Sound(5);
			this.LoopingSounds = new Sound[] { this.AtsBell, this.AtsChime, this.Eb };
			// --- play once ---
			this.AtsPBell = new Sound(2);
			this.AtcBell = new Sound(2);
			this.ToAts = new Sound(3);
			this.ToAtc = new Sound(4);
			this.PlayOnceSounds = new Sound[] { this.AtsPBell, this.AtcBell, this.ToAts, this.ToAtc };
		}
コード例 #14
0
ファイル: Sounds.cs プロジェクト: tsdworks/RAGLINK-2
        // --- constructors ---

        /// <summary>Creates a new instance of sounds.</summary>
        /// <param name="playSound">The delegate to the function to play sounds.</param>
        internal Sounds(PlaySoundDelegate playSound)
        {
            this.PlaySound = playSound;
            // --- looping ---
            this.AtsBell       = new Sound(0);
            this.AtsChime      = new Sound(1);
            this.Eb            = new Sounds.Sound(5);
            this.LoopingSounds = new Sound[] { this.AtsBell, this.AtsChime, this.Eb };
            // --- play once ---
            this.AtsPBell       = new Sound(2);
            this.AtcBell        = new Sound(2);
            this.ToAts          = new Sound(3);
            this.ToAtc          = new Sound(4);
            this.PlayOnceSounds = new Sound[] { this.AtsPBell, this.AtcBell, this.ToAts, this.ToAtc };
        }
コード例 #15
0
 // --- コンストラクタ ---
 /// <summary>新しいインスタンスを作成する</summary>
 /// <param name="panel">パネルに渡す値</param>
 /// <param name="playSound">サウンドを再生するためのデリゲート</param>
 internal Train(int[] panel, PlaySoundDelegate playSound)
 {
     this.PluginInitializing = false;
     this.Specs   = new VehicleSpecs(0, BrakeTypes.ElectromagneticStraightAirBrake, 0, false, 0);
     this.State   = new VehicleState(0.0, new Speed(0.0), 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
     this.Handles = new ReadOnlyHandles(new Handles(0, 0, 0, false));
     this.Doors   = DoorStates.None;
     this.Panel   = panel;
     this.Sounds  = new Sounds(playSound);
     this.Accel   = new Accel();
     this.Atc     = new Atc(this);
     this.AtsP    = new AtsP(this);
     this.Wiper   = new Wiper(this);
     this.Sub     = new Sub(this);
     this.Devices = new Device[] { this.Accel, this.Atc, this.AtsP, this.Wiper, this.Sub };
 }
コード例 #16
0
ファイル: Sounds.cs プロジェクト: s520/ATCFS_For_OpenBVE
        // --- コンストラクタ ---
        /// <summary>新しいインスタンスを作成する</summary>
        /// <param name="playSound">サウンドを再生する関数のデリゲート。</param>
        internal Sounds(PlaySoundDelegate playSound)
        {
            this.PlaySound = playSound;

            // --- 繰り返し再生 ---
            this.Eb            = new Sounds.Sound(13);
            this.LoopingSounds = new Sound[] { this.Eb };

            // --- 1回再生 ---
            this.AtspDing       = new Sound(2);
            this.AtcDing        = new Sound(7);
            this.AtcSwDownSound = new Sound(8);
            this.AtcSwUpSound   = new Sound(9);
            this.AtcAirSound    = new Sound(10);
            this.PlayOnceSounds = new List <Sound> {
                this.AtspDing, this.AtcDing, this.AtcSwDownSound, this.AtcSwUpSound, this.AtcAirSound
            };
        }
コード例 #17
0
        // --- constructors ---

        /// <summary>Creates a new instance of sounds.</summary>
        /// <param name="playSound">The delegate to the function to play sounds.</param>
        internal Sounds(PlaySoundDelegate playSound)
        {
            this.PlaySound = playSound;
            // --- looping ---
            this.AtsBell       = new Sound(0);
            this.AtsChime      = new Sound(1);
            this.ToAtsReminder = new Sound(10);
            this.ToAtcReminder = new Sound(11);
            this.Eb            = new Sounds.Sound(13);
            this.LoopingSounds = new Sound[] { this.AtsBell, this.AtsChime, this.ToAtsReminder, this.ToAtcReminder, this.Eb };
            // --- play once ---
            this.AtsPBell = new Sound(2);
            this.AtsPsPatternEstablishment = new Sound(3);
            this.AtsPsPatternRelease       = new Sound(4);
            this.AtsPsChime     = new Sound(5);
            this.AtcBell        = new Sound(7);
            this.ToAts          = new Sound(8);
            this.ToAtc          = new Sound(9);
            this.PlayOnceSounds = new Sound[] { this.AtsPBell, this.AtsPsPatternEstablishment, this.AtsPsPatternRelease, this.AtsPsChime, this.AtcBell, this.ToAts, this.ToAtc };
        }
コード例 #18
0
        public void RegisterInterface(IUpdate iUpdate)
        {
            BeginPaint    = new BeginPaintDelegate(iUpdate.BeginPaint);
            EndPaint      = new EndPaintDelegate(iUpdate.EndPaint);
            SetBounds     = new SetBoundsDelegate(iUpdate.SetBounds);
            Synchronize   = new SynchronizeDelegate(iUpdate.Synchronize);
            DesktopResize = new DesktopResizeDelegate(iUpdate.DesktopResize);
            BitmapUpdate  = new BitmapUpdateDelegate(iUpdate.BitmapUpdate);
            Palette       = new PaletteDelegate(iUpdate.Palette);
            PlaySound     = new PlaySoundDelegate(iUpdate.PlaySound);
            SurfaceBits   = new SurfaceBitsDelegate(iUpdate.SurfaceBits);

            update->BeginPaint    = Marshal.GetFunctionPointerForDelegate(BeginPaint);
            update->EndPaint      = Marshal.GetFunctionPointerForDelegate(EndPaint);
            update->SetBounds     = Marshal.GetFunctionPointerForDelegate(SetBounds);
            update->Synchronize   = Marshal.GetFunctionPointerForDelegate(Synchronize);
            update->DesktopResize = Marshal.GetFunctionPointerForDelegate(DesktopResize);
            update->BitmapUpdate  = Marshal.GetFunctionPointerForDelegate(BitmapUpdate);
            update->Palette       = Marshal.GetFunctionPointerForDelegate(Palette);
            update->PlaySound     = Marshal.GetFunctionPointerForDelegate(PlaySound);
            update->SurfaceBits   = Marshal.GetFunctionPointerForDelegate(SurfaceBits);
        }
コード例 #19
0
ファイル: Plugin.Sound.cs プロジェクト: leezer3/OpenBVE
			// constructors
			/// <summary>Creates a new instance of this class.</summary>
			/// <param name="playSound">The callback function for playing sounds.</param>
			/// <param name="count">The amount of sound instructions to use. This is 256 in Win32 plugins but can be a different value if needed.</param>
			internal SoundHelper(PlaySoundDelegate playSound, int count) {
				this.Sound = new int[count];
				this.LastSound = new int[count];
				this.Handles = new SoundHandle[count];
				this.PlaySound = playSound;
			}
コード例 #20
0
ファイル: SoundManager.cs プロジェクト: hkgsherlock/hkhr-atp2
 // constructors
 /// <summary>Initialises the sound manager. Call this method via the Load() method.</summary>
 /// <param name="playSound">The callback function for playing sounds.</param>
 /// <param name="numIndices">The number of sound indices to accomodate.</param>
 internal static void Initialise(PlaySoundDelegate playSound, int numIndices)
 {
     SoundHandles = new SoundHandle[numIndices];
     IsLooped = new bool[numIndices];
     LastVolume = new double[numIndices];
     LastPitch = new double[numIndices];
     PlaySound = playSound;
 }
コード例 #21
0
ファイル: Calling.cs プロジェクト: leezer3/bvec_ats
        // --- constructors ---

        /// <summary>Creates a new instance of this class.</summary>
        /// <param name="train">The underlying train.</param>
        /// <param name="playSound">The delegate to the function to play sounds.</param>
        internal Calling(Train train, PlaySoundDelegate playSound)
        {
            this.Train     = train;
            this.PlaySound = playSound;
        }
コード例 #22
0
ファイル: Runtime.cs プロジェクト: leezer3/OpenBVE
		// --- constructors ---
		/// <summary>Creates a new instance of this class.</summary>
		/// <param name="pluginFolder">The absolute path to the plugin folder.</param>
		/// <param name="trainFolder">The absolute path to the train folder.</param>
		/// <param name="playSound">The callback function for playing sounds.</param>
		/// /// <param name="addMessage">The callback function for adding interface messages.</param>
		public LoadProperties(string pluginFolder, string trainFolder, PlaySoundDelegate playSound, AddInterfaceMessageDelegate addMessage) {
			this.MyPluginFolder = pluginFolder;
			this.MyTrainFolder = trainFolder;
			this.MyPlaySound = playSound;
			this.MyAddInterfaceMessage = addMessage;
			this.MyFailureReason = null;
		}
コード例 #23
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            PlaySoundDelegate dge = new PlaySoundDelegate(PlaySoundFuntion);

            dge.BeginInvoke("行车故障.wav", null, null);
        }
コード例 #24
0
ファイル: Runtime.cs プロジェクト: sladen/openbve
 // --- constructors ---
 /// <summary>Creates a new instance of this class.</summary>
 /// <param name="pluginFolder">The absolute path to the plugin folder.</param>
 /// <param name="trainFolder">The absolute path to the train folder.</param>
 /// <param name="playSound">The callback function for playing sounds.</param>
 public LoadProperties(string pluginFolder, string trainFolder, PlaySoundDelegate playSound)
 {
     this.MyPluginFolder = pluginFolder;
     this.MyTrainFolder = trainFolder;
     this.MyPlaySound = playSound;
     this.MyFailureReason = null;
 }
コード例 #25
0
 // --- api functions ---
 /// <summary>Is called when the plugin is loaded.</summary>
 /// <param name="properties">The properties supplied to the plugin on loading.</param>
 /// <returns>Whether the plugin was loaded successfully.</returns>
 public bool Load(LoadProperties properties)
 {
     Panel = new int[2048];
     Sounds = new List<Sound>();
     PlaySound = properties.PlaySound;
     properties.Panel = this.Panel;
     properties.AISupport = AISupport.Basic;
     this.ScriptsDirectory = OpenBveApi.Path.CombineDirectory(properties.TrainFolder, "Scripts");
     try {
         string file = OpenBveApi.Path.CombineFile(properties.TrainFolder, "train.dat");
         string[] lines = System.IO.File.ReadAllLines(file);
         for (int i = 0; i < lines.Length; i++) {
             if (lines[i].Equals("#PRESSURE", StringComparison.OrdinalIgnoreCase)) {
                 string text = lines[i + 1];
                 int semicolon = text.IndexOf(';');
                 if (semicolon >= 0) {
                     text = text.Substring(0, semicolon).Trim();
                 } else {
                     text = text.Trim();
                 }
                 this.MaximumBrakeCylinderPressure = 1000.0 * double.Parse(text, System.Globalization.CultureInfo.InvariantCulture);
                 break;
             }
         }
     } catch {
         this.MaximumBrakeCylinderPressure = 490000.0;
     }
     return true;
 }
コード例 #26
0
ファイル: Update.cs プロジェクト: marwansamaha/Screenary
        public void RegisterInterface(IUpdate iUpdate)
        {
            BeginPaint = new BeginPaintDelegate(iUpdate.BeginPaint);
            EndPaint = new EndPaintDelegate(iUpdate.EndPaint);
            SetBounds = new SetBoundsDelegate(iUpdate.SetBounds);
            Synchronize = new SynchronizeDelegate(iUpdate.Synchronize);
            DesktopResize = new DesktopResizeDelegate(iUpdate.DesktopResize);
            BitmapUpdate = new BitmapUpdateDelegate(iUpdate.BitmapUpdate);
            Palette = new PaletteDelegate(iUpdate.Palette);
            PlaySound = new PlaySoundDelegate(iUpdate.PlaySound);
            SurfaceBits = new SurfaceBitsDelegate(iUpdate.SurfaceBits);

            update->BeginPaint = Marshal.GetFunctionPointerForDelegate(BeginPaint);
            update->EndPaint = Marshal.GetFunctionPointerForDelegate(EndPaint);
            update->SetBounds = Marshal.GetFunctionPointerForDelegate(SetBounds);
            update->Synchronize = Marshal.GetFunctionPointerForDelegate(Synchronize);
            update->DesktopResize = Marshal.GetFunctionPointerForDelegate(DesktopResize);
            update->BitmapUpdate = Marshal.GetFunctionPointerForDelegate(BitmapUpdate);
            update->Palette = Marshal.GetFunctionPointerForDelegate(Palette);
            update->PlaySound = Marshal.GetFunctionPointerForDelegate(PlaySound);
            update->SurfaceBits = Marshal.GetFunctionPointerForDelegate(SurfaceBits);
        }