cardwo.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. **********************************************************************
  3. * cardwo.h -- header file for card wave out functions
  4. * Copyright 1999, 2000 Creative Labs, Inc.
  5. *
  6. **********************************************************************
  7. *
  8. * Date Author Summary of changes
  9. * ---- ------ ------------------
  10. * October 20, 1999 Bertrand Lee base code release
  11. *
  12. **********************************************************************
  13. *
  14. * This program is free software; you can redistribute it and/or
  15. * modify it under the terms of the GNU General Public License as
  16. * published by the Free Software Foundation; either version 2 of
  17. * the License, or (at your option) any later version.
  18. *
  19. * This program is distributed in the hope that it will be useful,
  20. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. * GNU General Public License for more details.
  23. *
  24. * You should have received a copy of the GNU General Public
  25. * License along with this program; if not, write to the Free
  26. * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
  27. * USA.
  28. *
  29. **********************************************************************
  30. */
  31. #ifndef _CARDWO_H
  32. #define _CARDWO_H
  33. #include "icardwav.h"
  34. #include "audio.h"
  35. #include "voicemgr.h"
  36. #include "timer.h"
  37. /* setting this to other than a power of two may break some applications */
  38. #define WAVEOUT_MAXBUFSIZE MAXBUFSIZE
  39. #define WAVEOUT_DEFAULTFRAGLEN 20 /* Time to play a fragment in ms (latency) */
  40. #define WAVEOUT_DEFAULTBUFLEN 500 /* Time to play the entire buffer in ms */
  41. #define WAVEOUT_MINFRAGSHIFT 6 /* Minimum fragment size in bytes is 2^6 */
  42. #define WAVEOUT_MINFRAGS 3 /* _don't_ go bellow 3, it would break silence filling */
  43. #define WAVEOUT_MAXVOICES 6
  44. struct waveout_buffer {
  45. u16 ossfragshift;
  46. u32 numfrags;
  47. u32 fragment_size; /* in bytes units */
  48. u32 size; /* in bytes units */
  49. u32 pages; /* buffer size in page units*/
  50. u32 silence_pos; /* software cursor position (including silence bytes) */
  51. u32 hw_pos; /* hardware cursor position */
  52. u32 free_bytes; /* free bytes available on the buffer (not including silence bytes) */
  53. u8 fill_silence;
  54. u32 silence_bytes; /* silence bytes on the buffer */
  55. };
  56. struct woinst
  57. {
  58. u8 state;
  59. u8 num_voices;
  60. struct emu_voice voice[WAVEOUT_MAXVOICES];
  61. struct emu_timer timer;
  62. struct wave_format format;
  63. struct waveout_buffer buffer;
  64. wait_queue_head_t wait_queue;
  65. u8 mmapped;
  66. u32 total_copied; /* total number of bytes written() to the buffer (excluding silence) */
  67. u32 total_played; /* total number of bytes played including silence */
  68. u32 blocks;
  69. u8 device;
  70. spinlock_t lock;
  71. };
  72. int emu10k1_waveout_open(struct emu10k1_wavedevice *);
  73. void emu10k1_waveout_close(struct emu10k1_wavedevice *);
  74. void emu10k1_waveout_start(struct emu10k1_wavedevice *);
  75. void emu10k1_waveout_stop(struct emu10k1_wavedevice *);
  76. void emu10k1_waveout_getxfersize(struct woinst*, u32 *);
  77. void emu10k1_waveout_xferdata(struct woinst*, u8 __user *, u32 *);
  78. void emu10k1_waveout_fillsilence(struct woinst*);
  79. int emu10k1_waveout_setformat(struct emu10k1_wavedevice*, struct wave_format*);
  80. void emu10k1_waveout_update(struct woinst*);
  81. #endif /* _CARDWO_H */