?login_element?

Subversion Repositories NedoOS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. // Beeper engine
  2. // Copyright (C) 2021 by Juan J. Martinez <jjm@usebox.net>
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to deal
  6. // in the Software without restriction, including without limitation the rights
  7. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. // copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20. // THE SOFTWARE.
  21. //
  22. #ifndef _BEEPER_H
  23. #define _BEEPER_H
  24.  
  25. #include <stdint.h>
  26.  
  27. struct beeper_sfx {
  28.     uint8_t type;
  29.     uint8_t frames;
  30.     uint8_t freq;
  31.     uint8_t slide;
  32.     uint8_t next;
  33. };
  34.  
  35. // to init the beeper engine, provide a pointer to the effect table
  36. void beeper_init(const struct beeper_sfx *efx_table) __z88dk_fastcall;
  37.  
  38. // to queue a new effect
  39. // efx_no is...
  40. //
  41. //    0: no effect (stops sound)
  42. //    1: index 0 of the effect table
  43. //    2: ...
  44. //
  45. void beeper_queue(uint8_t efx_no) __z88dk_fastcall;
  46.  
  47. // to be called in the INT handler; call beeper_init first!
  48. void beeper_play();
  49. #endif
  50.