- Timestamp:
- Jan 26, 2007 2:14:21 PM (18 years ago)
- Location:
- trunk/src/VBox/Devices/Audio
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DevIchAc97.cpp
r332 r355 40 40 41 41 #undef LOG_VOICES 42 #ifndef VBOX 42 43 //#define USE_MIXER 44 #else 45 #define USE_MIXER 46 #endif 43 47 44 48 #define AC97_SSM_VERSION 1 … … 79 83 }; 80 84 85 #ifndef VBOX 81 86 #define SOFT_VOLUME 87 #else 88 #undef SOFT_VOLUME 89 #endif 82 90 #define SR_FIFOE BIT(4) /* rwc, fifo error */ 83 91 #define SR_BCIS BIT(3) /* rwc, buffer completion interrupt status */ … … 499 507 rvol = VOL_MASK - ((VOL_MASK * rvol) / 255); 500 508 lvol = VOL_MASK - ((VOL_MASK * lvol) / 255); 509 510 #ifdef VBOX 511 /* 512 * From AC'97 SoundMax Codec AD1981A: "Because AC '97 defines 6-bit volume registers, to 513 * maintain compatibility whenever the D5 or D13 bits are set to `1,' their respective 514 * lower five volume bits are automatically set to `1' by the Codec logic. On readback, 515 * all lower 5 bits will read ones whenever these bits are set to `1.'" 516 * 517 * Linux ALSA depends on this behavior. 518 */ 519 if (val & BIT(5)) 520 val |= BIT(4) | BIT(3) | BIT(2) | BIT(1) | BIT(0); 521 if (val & BIT(13)) 522 val |= BIT(12) | BIT(11) | BIT(10) | BIT(9) | BIT(8); 523 #endif 524 501 525 mixer_store (s, index, val); 502 526 } -
trunk/src/VBox/Devices/Audio/audio.c
r1 r355 133 133 }; 134 134 135 #ifdef VBOX 136 volume_t pcm_out_volume = 137 { 138 0, 139 UINT_MAX, 140 UINT_MAX 141 }; 142 #endif 143 135 144 /* http://www.df.lth.se/~john_e/gems/gem002d.html */ 136 145 /* http://www.multi-platforms.com/Tips/PopCount.htm */ … … 885 894 swlim = audio_MIN (swlim, samples); 886 895 if (swlim) { 896 #ifndef VBOX 887 897 sw->conv (sw->buf, buf, swlim, &sw->vol); 898 #else 899 sw->conv (sw->buf, buf, swlim, &pcm_out_volume); 900 #endif 888 901 } 889 902 … … 1699 1712 } 1700 1713 } 1714 } 1715 1716 void AUD_set_volume_out (SWVoiceOut *sw, int mute, uint8_t lvol, uint8_t rvol) 1717 { 1718 if (sw) 1719 { 1720 sw->vol.mute = mute; 1721 sw->vol.l = (uint32_t)lvol * 0x808080; /* maximum is INT_MAX = 0x7fffffff */ 1722 sw->vol.r = (uint32_t)rvol * 0x808080; /* maximum is INT_MAX = 0x7fffffff */ 1723 } 1724 } 1725 1726 void AUD_set_volume (audmixerctl_t mt, int *mute, uint8_t *lvol, uint8_t *rvol) 1727 { 1728 volume_t *vol = NULL; 1729 const char *name; 1730 1731 switch (mt) 1732 { 1733 case AUD_MIXER_VOLUME: 1734 name = "MASTER"; 1735 vol = &pcm_out_volume; 1736 break; 1737 case AUD_MIXER_PCM: 1738 name = "PCM_OUT"; 1739 break; 1740 case AUD_MIXER_LINE_IN: 1741 name = "LINE_IN"; 1742 break; 1743 default: 1744 return; 1745 1746 } 1747 1748 if (vol) 1749 { 1750 vol->mute = *mute; 1751 vol->l = ((uint32_t)*lvol) * 0x808080; /* maximum is INT_MAX = 0x7fffffff */ 1752 vol->r = ((uint32_t)*rvol) * 0x808080; /* maximum is INT_MAX = 0x7fffffff */ 1753 } 1754 #if 0 1755 LogRel(("AUDIO: Set '%s' volume to %d%%/%d%%\n", name, (*lvol*100)/255, (*rvol*100)/255l)); 1756 #endif 1757 } 1758 1759 void AUD_set_record_source (audrecsource_t *ars, audrecsource_t *als) 1760 { 1761 LogRel(("AUDIO: set_record_source ars=%d als=%d (not implemented)\n", *ars, *als)); 1701 1762 } 1702 1763 -
trunk/src/VBox/Devices/Audio/audio.h
r1 r355 55 55 AUD_CNOTIFY_DISABLE 56 56 } audcnotification_e; 57 58 typedef enum 59 { 60 AUD_MIXER_VOLUME, 61 AUD_MIXER_PCM, 62 AUD_MIXER_LINE_IN 63 } audmixerctl_t; 64 65 typedef enum 66 { 67 AUD_REC_MIC, 68 AUD_REC_CD, 69 AUD_REC_VIDEO, 70 AUD_REC_AUX, 71 AUD_REC_LINE_IN, 72 AUD_REC_PHONE 73 } audrecsource_t; 57 74 58 75 struct audio_capture_ops { … … 141 158 uint64_t AUD_get_elapsed_usec_in (SWVoiceIn *sw, QEMUAudioTimeStamp *ts); 142 159 160 void AUD_set_volume_out (SWVoiceOut *po, int mute, uint8_t lvol, uint8_t rvol); 161 void AUD_set_volume (audmixerctl_t mt, int *mute, uint8_t *lvol, uint8_t *rvol); 162 void AUD_set_record_source (audrecsource_t *ars, audrecsource_t *als); 163 143 164 static inline void *advance (void *p, int incr) 144 165 { … … 159 180 __typeof (b) tb = b; \ 160 181 ((ta)>(tb)?(tb):(ta)); \ 161 }))182 })) 162 183 163 184 #define audio_MAX(a, b) ( __extension__ ({ \ … … 165 186 __typeof (b) tb = b; \ 166 187 ((ta)<(tb)?(tb):(ta)); \ 167 }))188 })) 168 189 #else 169 190 #define audio_MIN(a, b) ((a)>(b)?(b):(a)) -
trunk/src/VBox/Devices/Audio/audio_int.h
r1 r355 26 26 27 27 #ifdef CONFIG_COREAUDIO 28 #ifndef VBOX 28 29 #define FLOAT_MIXENG 30 #else 31 #undef FLOAT_MIXENG 32 #endif 29 33 /* #define RECIPROCAL */ 30 34 #endif -
trunk/src/VBox/Devices/Audio/mixeng.c
r1 r355 28 28 #include "audio.h" 29 29 #include <iprt/alloc.h> 30 #ifdef VBOX 31 #include <iprt/asm.h> 32 #endif 30 33 31 34 #define AUDIO_CAP "mixeng" 32 35 #include "audio_int.h" 33 36 37 #ifndef VBOX 34 38 #define NOVOL 39 #endif 35 40 36 41 /* 8 bit */ -
trunk/src/VBox/Devices/Audio/mixeng.h
r1 r355 27 27 struct HWVoiceOut; 28 28 29 #ifdef VBOX 30 /* use faster ASMMult2xS32RetS64 */ 31 typedef struct { int mute; uint32_t r; uint32_t l; } volume_t; 32 typedef struct { int64_t l; int64_t r; } st_sample_t; 33 #else /* !VBOX */ 29 34 #ifdef FLOAT_MIXENG 30 35 typedef float real_t; … … 35 40 typedef struct { int64_t l; int64_t r; } st_sample_t; 36 41 #endif 42 #endif /* VBOX */ 37 43 38 44 typedef void (t_sample) (st_sample_t *dst, const void *src, -
trunk/src/VBox/Devices/Audio/mixeng_template.h
r1 r355 35 35 #define VOL(a, b) a 36 36 #else 37 #ifdef VBOX 38 #ifdef SIGNED 39 #define VOL(a, b) ((ASMMult2xS32RetS64(a, b) >> 31)) 40 #else 41 #define VOL(a, b) ((ASMMult2xU32RetU64(a, b) >> 31)) 42 #endif 43 #else /* !VBOX */ 37 44 #ifdef FLOAT_MIXENG 38 45 #define VOL(a, b) ((a) * (b)) … … 41 48 #endif 42 49 #endif 50 #endif /* !VBOX */ 43 51 44 52 #define ET glue (ENDIAN_CONVERSION, glue (_, IN_T))
Note:
See TracChangeset
for help on using the changeset viewer.