Changeset 6233c4e in mainline
- Timestamp:
- 2011-10-24T21:50:31Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 88dcd19
- Parents:
- 0b4f060
- Location:
- uspace/drv/audio/sb16
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/audio/sb16/dsp.c
r0b4f060 r6233c4e 43 43 #include "dsp.h" 44 44 45 #define PLAYBACK_16BIT 0x1046 #define PLAYBACK_STEREO 0x2047 48 45 #define BUFFER_SIZE (PAGE_SIZE / 4) 49 46 #define PLAY_BLOCK_SIZE (BUFFER_SIZE / 2) … … 145 142 static inline size_t sample_count(uint8_t mode, size_t byte_count) 146 143 { 147 if (mode & PLAYBACK_16BIT) {144 if (mode & DSP_MODE_16BIT) { 148 145 return byte_count / 2; 149 146 } … … 279 276 dsp->playing.mode = 0; 280 277 if (sample_size == 16) 281 dsp->playing.mode |= PLAYBACK_16BIT;278 dsp->playing.mode |= DSP_MODE_16BIT; 282 279 if (channels == 2) 283 dsp->playing.mode |= PLAYBACK_STEREO;280 dsp->playing.mode |= DSP_MODE_STEREO; 284 281 285 282 const size_t samples = sample_count(dsp->playing.mode, play_size); 286 283 287 ddf_log_debug("Playing sound(%hhx): %zu(%zu) bytes => %zu samples.\n",288 dsp->playing.mode, play_size, size, samples);284 ddf_log_debug("Playing %s sound: %zu(%zu) bytes => %zu samples.\n", 285 mode_to_str(dsp->playing.mode), play_size, size, samples); 289 286 290 287 memcpy(dsp->buffer.data, dsp->playing.data, copy_size); -
uspace/drv/audio/sb16/dsp_commands.h
r0b4f060 r6233c4e 162 162 DMA_16B_EXIT = 0xd9, /* Ends DMA transfer and terminates I/O process */ 163 163 } dsp_command_t; 164 /*----------------------------------------------------------------------------*/ 165 #define DSP_MODE_16BIT 0x10 166 #define DSP_MODE_STEREO 0x20 167 168 static inline const char * mode_to_str(uint8_t mode) 169 { 170 if (mode & 0xcf) 171 return "unknown"; 172 static const char * names[] = { 173 "unsigned mono (8bit)", 174 "signed mono (16bit)", 175 "unsigned stereo (8bit)", 176 "signed stereo (16bit)", 177 }; 178 return names[mode >> 4]; 179 } 164 180 165 181 #endif
Note:
See TracChangeset
for help on using the changeset viewer.