Changeset 7525 in vbox
- Timestamp:
- Mar 25, 2008 10:17:49 AM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 28995
- Location:
- trunk/src/VBox
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/audio.c
r6598 r7525 1870 1870 case AUD_MIXER_PCM: 1871 1871 name = "PCM_OUT"; 1872 vol = &pcm_out_volume; 1872 1873 break; 1873 1874 case AUD_MIXER_LINE_IN: -
trunk/src/VBox/Devices/Audio/solaudio.c
r7454 r7525 59 59 } conf = 60 60 { 61 INIT_FIELD (cbBuffer =) 8912,61 INIT_FIELD (cbBuffer =) 4352, 62 62 }; 63 63 … … 123 123 124 124 125 static char *solaudio_getdevice ( )125 static char *solaudio_getdevice (void) 126 126 { 127 127 /* This is for multiple audio devices where env. var determines current one, 128 128 * otherwise else we fallback to default. 129 129 */ 130 c har *pszAudioDev = RTEnvGet("AUDIODEV");130 const char *pszAudioDev = RTEnvGet("AUDIODEV"); 131 131 if (pszAudioDev) 132 132 return RTStrDup(pszAudioDev); … … 141 141 int AudioCtl; 142 142 struct stat FileStat; 143 c onst char *pszAudioDev = NULL;144 c onst char *pszAudioCtl = "/dev/audioctl";143 char *pszAudioDev = NULL; 144 char *pszAudioCtl = NULL; 145 145 audio_info_t AudioInfo; 146 146 … … 149 149 { 150 150 LogRel(("solaudio: solaudio_getdevice() failed to return a valid device.\n")); 151 goto err;151 return -1; 152 152 } 153 153 … … 155 155 { 156 156 LogRel(("solaudio: failed to stat %s\n", pszAudioDev)); 157 goto err ;157 goto err2; 158 158 } 159 159 … … 161 161 { 162 162 LogRel(("solaudio: invalid mode for %s\n", pszAudioDev)); 163 goto err ;163 goto err2; 164 164 } 165 165 … … 168 168 { 169 169 LogRel(("solaudio: failed to open %s\n", pszAudioDev)); 170 goto err; 171 } 172 170 goto err2; 171 } 172 173 RTStrAPrintf(&pszAudioCtl, "%sctl", pszAudioDev); 173 174 AudioCtl = open(pszAudioCtl, O_WRONLY | O_NONBLOCK); 174 175 if (AudioCtl < 0) … … 193 194 AudioInfo.play.buffer_size = info->play.buffer_size; 194 195 AudioInfo.play.gain = AUDIO_MAX_GAIN; 195 AudioInfo.play.balance = AUDIO_MID_BALANCE;196 196 if (ioctl(AudioDev, AUDIO_SETINFO, &AudioInfo) < 0) 197 197 { … … 204 204 *pfd = AudioDev; 205 205 *pctl_fd = AudioCtl; 206 RTStrFree(pszAudioDev); 207 RTStrFree(pszAudioCtl); 206 208 return 0; 207 209 208 210 err: 211 RTStrFree(pszAudioCtl); 212 err2: 209 213 RTStrFree(pszAudioDev); 210 214 return -1; … … 224 228 AudioInfo.play.channels = as->nchannels; 225 229 AudioInfo.play.precision = aud_to_solfmt(as->fmt); 230 #if 0 231 /* Not really needed. */ 232 int cbPerSample = (AudioInfo.play.channels * AudioInfo.play.precision) / 8; 233 int cbPerSecond = cbPerSample * AudioInfo.play.sample_rate; 234 AudioInfo.play.buffer_size = cbPerSecond > 131072 ? conf.cbBuffer : conf.cbBuffer / 2; 235 #endif 226 236 AudioInfo.play.buffer_size = conf.cbBuffer; 237 227 238 if (as->fmt == AUD_FMT_U8) 228 239 AudioInfo.play.encoding = AUDIO_ENCODING_LINEAR8; … … 260 271 static void solaudio_stop (solaudioVoiceOut *sol) 261 272 { 273 audio_info_t AudioInfo; 262 274 LogFlow(("solaudio: stop\n")); 263 275 if (sol->AudioDev < 0 || sol->AudioCtl < 0) … … 269 281 if (ioctl(sol->AudioCtl, I_SETSIG, 0) < 0) 270 282 { 271 Log Rel(("solaudio: failed to stop signalling\n"));283 Log(("solaudio: failed to stop signalling\n")); 272 284 return; 273 285 } … … 275 287 if (ioctl(sol->AudioDev, I_FLUSH, FLUSHW) < 0) 276 288 { 277 Log (("solaudio: failed to drop unplayed buffers\n"));289 LogRel(("solaudio: failed to drop unplayed buffers\n")); 278 290 return; 279 291 } 292 293 AUDIO_INITINFO(&AudioInfo); 294 AudioInfo.play.samples = 0; 295 AudioInfo.play.pause = 0; 296 AudioInfo.play.eof = 0; 297 AudioInfo.play.error = 0; 298 sol->cBuffersPlayed = 0; 299 if (ioctl(sol->AudioDev, AUDIO_SETINFO, &AudioInfo) < 0) 300 { 301 LogRel(("solaudio: AUDIO_SETINFO failed during stop.\n")); 302 return; 303 } 304 } 305 306 307 static void solaudio_fini_out (HWVoiceOut *hw) 308 { 309 solaudioVoiceOut *sol = (solaudioVoiceOut *) hw; 310 solaudio_stop (sol); 280 311 281 312 close(sol->AudioDev); … … 283 314 close(sol->AudioCtl); 284 315 sol->AudioCtl = -1; 285 sol->cBuffersPlayed = 0;286 316 if (sol->pPCMBuf) 287 317 { … … 289 319 sol->pPCMBuf = NULL; 290 320 } 291 } 292 293 294 static void solaudio_fini_out (HWVoiceOut *hw) 295 { 296 solaudioVoiceOut *sol = (solaudioVoiceOut *) hw; 297 solaudio_stop (sol); 321 298 322 LogFlow(("solaudio: fini_out done\n")); 299 323 } … … 312 336 } 313 337 314 cbBuffer = AudioInfo.play.buffer_size * (2 + AudioInfo.play.eof - sol->cBuffersPlayed); 338 if (sol->cBuffersPlayed - AudioInfo.play.eof <= 2) 339 cbBuffer = AudioInfo.play.buffer_size; 315 340 316 341 LogFlow(("avail: eof=%d samples=%d bufsize=%d bufplayed=%d avail=%d\n", AudioInfo.play.eof, AudioInfo.play.samples, … … 328 353 329 354 WaitTimeSpec.tv_sec = 0; 330 WaitTimeSpec.tv_nsec = 1000000 ;331 332 while (AudioInfo.play.eof < pSol->cBuffersPlayed - 2)355 WaitTimeSpec.tv_nsec = 100000000; 356 357 while (AudioInfo.play.eof + 10 < pSol->cBuffersPlayed) 333 358 { 334 359 nanosleep(&WaitTimeSpec, NULL); … … 373 398 break; 374 399 400 /* Increment eof marker for synchronous buffer processed */ 401 write (pSol->AudioDev, NULL, 0); 402 pSol->cBuffersPlayed++; 403 375 404 hw->rpos = (hw->rpos + csToWrite) % hw->samples; 376 405 csSamples -= csToWrite; 377 406 } 378 /* Increment eof marker for synchronous buffer processed */379 write (pSol->AudioDev, NULL, 0);380 pSol->cBuffersPlayed++;381 407 return csDecr; 382 408 } … … 392 418 /* reset the eof marker and samples markers */ 393 419 audio_info_t AudioInfo; 420 LogFlow(("solaudio: voice_enable\n")); 394 421 AUDIO_INITINFO(&AudioInfo); 395 422 ioctl(pSol->AudioDev, AUDIO_GETINFO, &AudioInfo); … … 400 427 401 428 audio_pcm_info_clear_buf(&hw->info, pSol->pPCMBuf, hw->samples); 402 LogFlow(("solaudio: voice_enable\n"));403 429 break; 404 430 } … … 429 455 static void solaudio_audio_fini (void *opaque) 430 456 { 431 (void) opaque; 432 } 433 434 435 static struct audio_pcm_ops solaudio_pcm_ops = { 457 NOREF(opaque); 458 } 459 460 461 static struct audio_pcm_ops solaudio_pcm_ops = 462 { 436 463 solaudio_init_out, 437 464 solaudio_fini_out, … … 447 474 }; 448 475 449 static struct audio_option solaudio_options[] = { 476 static struct audio_option solaudio_options[] = 477 { 450 478 {"BUFFER_SIZE", AUD_OPT_INT, &conf.cbBuffer, 451 479 "Size of the buffer in bytes", NULL, 0}, … … 453 481 }; 454 482 455 struct audio_driver solaudio_audio_driver = { 483 struct audio_driver solaudio_audio_driver = 484 { 456 485 INIT_FIELD (name = ) "solaudio", 457 486 INIT_FIELD (descr = ) "SolarisAudio http://sun.com", -
trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp
r7466 r7525 234 234 #else 235 235 bool fWin = false; 236 #endif 237 #ifdef RT_OS_SOLARIS 238 bool fSolaris = true; 239 #else 240 bool fSolaris = false; 236 241 #endif 237 242 #ifdef RT_OS_DARWIN … … 371 376 #endif 372 377 } 378 if (fSolaris) 379 { 380 RTPrintf( "|solaudio"); 381 } 373 382 if (fLinux) 374 383 { … … 1435 1444 pszDrv = "CoreAudio"; 1436 1445 break; 1446 case AudioDriverType_SolAudio: 1447 if (details == VMINFO_MACHINEREADABLE) 1448 pszDrv = "solaudio"; 1449 else 1450 pszDrv = "SolAudio"; 1451 break; 1437 1452 default: 1438 1453 if (details == VMINFO_MACHINEREADABLE) … … 4923 4938 # endif 4924 4939 #endif /* !RT_OS_LINUX */ 4940 #ifdef RT_OS_SOLARIS 4941 else if (strcmp(audio, "solaudio") == 0) 4942 { 4943 CHECK_ERROR(audioAdapter, COMSETTER(AudioDriver)(AudioDriverType_SolAudio)); 4944 CHECK_ERROR(audioAdapter, COMSETTER(Enabled)(true)); 4945 } 4946 4947 #endif /* !RT_OS_SOLARIS */ 4925 4948 #ifdef RT_OS_DARWIN 4926 4949 else if (strcmp(audio, "coreaudio") == 0) -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxGlobal.cpp
r7466 r7525 2353 2353 audioDriverTypes [KAudioDriverType_WinMM] = 2354 2354 tr ("Windows Multimedia", "AudioDriverType"); 2355 audioDriverTypes [KAudioDriverType_SolAudio] = 2356 tr ("Solaris Audio", "AudioDriverType"); 2355 2357 audioDriverTypes [KAudioDriverType_OSS] = 2356 2358 tr ("OSS Audio Driver", "AudioDriverType"); -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMSettingsDlg.ui.h
r7466 r7525 863 863 cbAudioDriver->insertItem (vboxGlobal().toString (KAudioDriverType_WinMM)); 864 864 # endif 865 #elif defined Q_OS_SOLARIS 866 cbAudioDriver->insertItem (vboxGlobal().toString (KAudioDriverType_SolAudio)); 865 867 #elif defined Q_OS_LINUX 866 868 cbAudioDriver->insertItem (vboxGlobal().toString (KAudioDriverType_OSS)); -
trunk/src/VBox/Main/AudioAdapterImpl.cpp
r7466 r7525 232 232 case AudioDriverType_DirectSound: 233 233 #endif /* RT_OS_WINDOWS */ 234 #ifdef RT_OS_SOLARIS 235 case AudioDriverType_SolAudio: 236 #endif 234 237 #ifdef RT_OS_LINUX 235 238 case AudioDriverType_OSS: … … 383 386 mData->mAudioDriver = AudioDriverType_DirectSound; 384 387 #endif // RT_OS_WINDOWS 388 #ifdef RT_OS_SOLARIS 389 else if (strcmp (driver, "SolAudio") == 0) 390 mData->mAudioDriver = AudioDriverType_SolAudio; 391 #endif // RT_OS_SOLARIS 385 392 #ifdef RT_OS_LINUX 386 393 else if (strcmp (driver, "OSS") == 0) … … 473 480 } 474 481 #endif /* RT_OS_WINDOWS */ 482 #ifdef RT_OS_SOLARIS 483 case AudioDriverType_SolAudio: 484 { 485 driverStr = "SolAudio"; 486 break; 487 } 488 #endif 475 489 #ifdef RT_OS_LINUX 476 490 case AudioDriverType_ALSA: -
trunk/src/VBox/Main/ConsoleImpl2.cpp
r7466 r7525 1404 1404 } 1405 1405 #endif /* RT_OS_WINDOWS */ 1406 #ifdef RT_OS_SOLARIS 1407 case AudioDriverType_SolAudio: 1408 { 1409 rc = CFGMR3InsertString(pCfg, "AudioDriver", "solaudio"); RC_CHECK(); 1410 break; 1411 } 1412 #endif 1406 1413 #ifdef RT_OS_LINUX 1407 1414 case AudioDriverType_OSS: -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r7466 r7525 9252 9252 <const name="MMPM" value="6"/> 9253 9253 <const name="Pulse" value="7"/> 9254 <const name=" ESD"value="8"/>9254 <const name="SolAudio" value="8"/> 9255 9255 </enum> 9256 9256 -
trunk/src/VBox/Main/xml/SettingsConverter.xsl
r7492 r7525 306 306 <xsl:when test="@driver='winmm'">WinMM</xsl:when> 307 307 <xsl:when test="@driver='dsound'">DirectSound</xsl:when> 308 <xsl:when test="@driver=' esd'">ESD</xsl:when>308 <xsl:when test="@driver='solaudio'">SolAudio</xsl:when> 309 309 <xsl:when test="@driver='mmpm'">MMPM</xsl:when> 310 310 <xsl:otherwise> -
trunk/src/VBox/Main/xml/VirtualBox-settings-solaris.xsd
r7466 r7525 99 99 <xsd:restriction base="xsd:token"> 100 100 <xsd:enumeration value="Null"/> 101 <xsd:enumeration value=" ESD"/>101 <xsd:enumeration value="SolAudio"/> 102 102 </xsd:restriction> 103 103 </xsd:simpleType>
Note:
See TracChangeset
for help on using the changeset viewer.