Reference Codebot.Hardware.pas
Part of the Codebot Render package
The Codebot.Hardware unit plays audio and reads the keyboard, mouse, and joysticks using SDL alone, so it works the same in both hosts.
You add sounds and music to Audio as named sources from files, streams, or assets, and they are kept in memory. To play a source it is loaded into one of a fixed number of banks, each with its own volume, pan, position, and loop count, and the banks that are playing are mixed together on the audio thread. MP3, Ogg Vorbis, uncompressed WAV, and tracker music such as MOD, S3M, XM, and IT are supported. Every source must be stereo with 16 bit samples at 44100 Hz, and a source in any other format is refused when you add it. If no audio device can be opened, sources and banks still work but nothing is heard.
Keyboard, Mouse, and Joysticks hold the state of the hardware as it was at the start of the frame, when the hosts call ScanHardware. You can check whether a key is down, or was just pressed or released. When SDL recognizes a joystick as a gamepad, you also get its named buttons and axes.
Items 185 items
| Name | Kind | Line |
|---|---|---|
| Audio | function | 375 |
| AudioFormatDetect | function | 106, 108 |
| AudioFormatNames | constant | 96 |
| AudioFormatTime | function | 110, 112 |
| DefAudioBankCount | constant | 65 |
| DefBitsPerSample | constant | 69 |
| DefChannels | constant | 67 |
| DefMixingSamples | constant | 73 |
| DefMixingSize | constant | 75 |
| DefSampleRate | constant | 71 |
| EAudioException | class | 78 |
| EAudioFormatException | class | 81 |
| IsKeyDown | function | 423 |
| Joysticks | function | 623 |
| Keyboard | function | 413 |
| Mouse | function | 500 |
| PAudioSample | pointer | 273 |
| PumpHardware | procedure | 635 |
| ScanHardware | procedure | 629 |
| ScanHardwarePumps | variable | 641 |
| TAudio | class | 291 |
| Add | function | 325, 327 |
| AddAsset | function | 331 |
| BankExists | function | 321 |
| Create | constructor | 318 |
| Destroy | destructor | 319 |
| IsPlaying | function | 323 |
| Next | function | 340 |
| Play | function | 346, 349, 352 |
| Remove | procedure | 333 |
| Source | function | 335, 337 |
| Available | property | 355 |
| BankCount | property | 367 |
| Banks | property | 365 |
| OnMix | property | 371 |
| Paused | property | 357 |
| SourceCount | property | 363 |
| Sources | property | 361 |
| Volume | property | 359 |
| TAudioBank | class | 178 |
| Create | constructor | 211 |
| Destroy | destructor | 212 |
| FadeIn | procedure | 225 |
| FadeOut | procedure | 228 |
| Load | procedure | 214, 216, 218 |
| Reset | procedure | 231 |
| Unload | procedure | 220 |
| Completed | property | 238 |
| Duration | property | 235 |
| Loop | property | 248 |
| LoopCount | property | 246 |
| Muted | property | 250 |
| Pan | property | 253 |
| Paused | property | 242 |
| Position | property | 258 |
| Reserved | property | 264 |
| Source | property | 233 |
| Volume | property | 261 |
| TAudioDecoder | class | 156 |
| Create | constructor | 166 |
| Decode | function | 171 |
| GetPosition | function | 163 |
| SetPosition | procedure | 164 |
| Position | property | 173 |
| TAudioFormat | enum | 84 |
| afUnsupported | enum value | 85 |
| afMp3 | enum value | 87 |
| afTracker | enum value | 89 |
| afVorbis | enum value | 91 |
| afWave | enum value | 93 |
| TAudioMixEvent | procedural | 284 |
| TAudioOffsets | array | 118 |
| TAudioSample | record | 268 |
| Left | field | 269 |
| Right | field | 270 |
| TAudioSource | class | 131 |
| Create | constructor | 141 |
| Destroy | destructor | 142 |
| Duration | property | 148 |
| Format | property | 150 |
| Id | property | 146 |
| Name | property | 144 |
| TGamepadAxis | enum | 517 |
| gaLeftX | enum value | 517 |
| gaLeftY | enum value | 517 |
| gaRightX | enum value | 517 |
| gaRightY | enum value | 517 |
| gaLeftTrigger | enum value | 517 |
| gaRightTrigger | enum value | 518 |
| TGamepadButton | enum | 511 |
| gbA | enum value | 511 |
| gbB | enum value | 511 |
| gbX | enum value | 511 |
| gbY | enum value | 511 |
| gbBack | enum value | 511 |
| gbGuide | enum value | 511 |
| gbStart | enum value | 511 |
| gbLeftStick | enum value | 511 |
| gbRightStick | enum value | 512 |
| gbLeftShoulder | enum value | 512 |
| gbRightShoulder | enum value | 512 |
| gbUp | enum value | 512 |
| gbDown | enum value | 512 |
| gbLeft | enum value | 512 |
| gbRight | enum value | 513 |
| TJoystick | class | 530 |
| Create | constructor | 558 |
| Destroy | destructor | 559 |
| Attached | property | 563 |
| Axes | property | 576 |
| AxisCount | property | 571 |
| ButtonCount | property | 577 |
| Buttons | property | 579 |
| GamepadAxes | property | 570 |
| GamepadButtons | property | 568 |
| HatCount | property | 581 |
| Hats | property | 582 |
| IsGamepad | property | 565 |
| Name | property | 561 |
| TrackballCount | property | 584 |
| Trackballs | property | 585 |
| TJoystickHat | enum | 506 |
| hatCenter | enum value | 506 |
| hatUp | enum value | 506 |
| hatRight | enum value | 506 |
| hatDown | enum value | 506 |
| hatLeft | enum value | 506 |
| hatRightUp | enum value | 506 |
| hatRightDown | enum value | 507 |
| hatLeftUp | enum value | 507 |
| hatLeftDown | enum value | 507 |
| TJoysticks | class | 591 |
| Axis | function | 609 |
| ButtonDown | function | 607 |
| Create | constructor | 603 |
| Destroy | destructor | 604 |
| GamepadAxis | function | 615 |
| GamepadDown | function | 612 |
| Count | property | 617 |
| Joystick | property | 619 |
| TJoystickTrackball | record | 521 |
| XDelta | field | 522 |
| YDelta | field | 523 |
| TKeyboard | class | 389 |
| Key | property | 403 |
| Pressed | property | 405 |
| Released | property | 407 |
| ShiftState | property | 409 |
| TKeyStates | array | 381 |
| TMouse | class | 444 |
| Destroy | destructor | 472 |
| Button | property | 476 |
| Buttons | property | 474 |
| Captured | property | 491 |
| Cursor | property | 496 |
| Pressed | property | 478 |
| Released | property | 480 |
| Visible | property | 493 |
| X | property | 483 |
| XDelta | property | 487 |
| Y | property | 484 |
| YDelta | property | 488 |
| TMouseCursor | enum | 437 |
| cursorDefault | enum value | 437 |
| cursorNone | enum value | 437 |
| cursorArrow | enum value | 437 |
| cursorIBeam | enum value | 437 |
| cursorWait | enum value | 438 |
| cursorCross | enum value | 438 |
| cursorHand | enum value | 438 |
| cursorNo | enum value | 438 |
| cursorSizeAll | enum value | 438 |
| cursorSizeNS | enum value | 438 |
| cursorSizeWE | enum value | 439 |
| cursorSizeNWSE | enum value | 439 |
| cursorSizeNESW | enum value | 439 |
| TSceneButton | enum | 430 |
| buttonNone | enum value | 430 |
| buttonLeft | enum value | 430 |
| buttonRight | enum value | 430 |
| buttonMiddle | enum value | 430 |
| buttonExtra1 | enum value | 431 |
| buttonExtra2 | enum value | 431 |
| TSceneButtons | set | 433 |
| VirtualKey | function | 416 |