A simple audio engine for Go with an SDL2 back-end and others to come eventually.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

88 lines
1.6 KiB

  1. // Package null implements a dummy audio driver that doesn't play any audio.
  2. package null
  3. // Engine is a null audio engine.
  4. type Engine struct{}
  5. // Playable is a null music or sound effect.
  6. type Playable struct{}
  7. // New creates a null engine.
  8. func New() *Engine {
  9. return &Engine{}
  10. }
  11. // Setup the null engine (do nothing).
  12. func (e *Engine) Setup() error {
  13. return nil
  14. }
  15. // Teardown the null engine (do nothing).
  16. func (e *Engine) Teardown() error {
  17. return nil
  18. }
  19. // Playing returns false.
  20. func (e *Engine) Playing() bool {
  21. return false
  22. }
  23. // PlayingMusic returns false.
  24. func (e *Engine) PlayingMusic() bool {
  25. return false
  26. }
  27. // PlayingSound returns false.
  28. func (e *Engine) PlayingSound() bool {
  29. return false
  30. }
  31. // StopAll does nothing.
  32. func (e *Engine) StopAll() {}
  33. // StopMusic does nothing.
  34. func (e *Engine) StopMusic() {}
  35. // StopSounds does nothing.
  36. func (e *Engine) StopSounds() {}
  37. // LoadMusic loads nothing.
  38. func (e *Engine) LoadMusic(filename string) (Playable, error) {
  39. return Playable{}, nil
  40. }
  41. // LoadMusicBin loads nothing.
  42. func (e *Engine) LoadMusicBin(data []byte) (Playable, error) {
  43. return Playable{}, nil
  44. }
  45. // LoadSound loads nothing.
  46. func (e *Engine) LoadSound(filename string) (Playable, error) {
  47. return Playable{}, nil
  48. }
  49. // LoadSoundBin loads nothing.
  50. func (e *Engine) LoadSoundBin(data []byte) (Playable, error) {
  51. return Playable{}, nil
  52. }
  53. // Play nothing.
  54. func (p Playable) Play(loops int) error {
  55. return nil
  56. }
  57. // Pause nothing
  58. func (p Playable) Pause() error {
  59. return nil
  60. }
  61. // Stop nothing.
  62. func (p Playable) Stop() error {
  63. return nil
  64. }
  65. // Destroy nothing.
  66. func (p Playable) Destroy() error {
  67. return nil
  68. }