Changeset 73205 in vbox
- Timestamp:
- Jul 18, 2018 2:44:55 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DevSB16.cpp
r71766 r73205 5 5 6 6 /* 7 * Copyright (C) 2015-201 7Oracle Corporation7 * Copyright (C) 2015-2018 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 220 220 * Internal Functions * 221 221 *********************************************************************************************************************************/ 222 static int sb16CheckAndReOpenOut(PSB16STATE pThis); 222 223 static int sb16OpenOut(PSB16STATE pThis, PPDMAUDIOSTREAMCFG pCfg); 223 224 static void sb16CloseOut(PSB16STATE pThis); … … 348 349 static void continue_dma8(PSB16STATE pThis) 349 350 { 350 if (pThis->freq > 0) 351 { 352 /* At the moment we only have one stream, the output stream. */ 353 PPDMAUDIOSTREAMCFG pCfg = &pThis->Out.Cfg; 354 355 pCfg->enmDir = PDMAUDIODIR_OUT; 356 pCfg->DestSource.Dest = PDMAUDIOPLAYBACKDEST_FRONT; 357 pCfg->enmLayout = PDMAUDIOSTREAMLAYOUT_NON_INTERLEAVED; 358 359 pCfg->Props.uHz = pThis->freq; 360 pCfg->Props.cChannels = 1 << pThis->fmt_stereo; 361 pCfg->Props.cBits = pThis->fmt_bits; 362 pCfg->Props.fSigned = RT_BOOL(pThis->fmt_signed); 363 pCfg->Props.cShift = PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(pCfg->Props.cBits, pCfg->Props.cChannels); 364 365 strcpy(pCfg->szName, "Output"); 366 367 sb16CloseOut(pThis); 368 369 int rc = sb16OpenOut(pThis, pCfg); 370 AssertRC(rc); 371 } 372 351 sb16CheckAndReOpenOut(pThis); 373 352 sb16Control(pThis, 1); 374 353 } … … 494 473 } 495 474 496 if (pThis->freq) 497 { 498 /* At the moment we only have one stream, the output stream. */ 499 PPDMAUDIOSTREAMCFG pCfg = &pThis->Out.Cfg; 500 501 pCfg->enmDir = PDMAUDIODIR_OUT; 502 pCfg->DestSource.Dest = PDMAUDIOPLAYBACKDEST_FRONT; 503 pCfg->enmLayout = PDMAUDIOSTREAMLAYOUT_NON_INTERLEAVED; 504 505 pCfg->Props.uHz = pThis->freq; 506 pCfg->Props.cChannels = 1 << pThis->fmt_stereo; 507 pCfg->Props.cBits = pThis->fmt_bits; 508 pCfg->Props.fSigned = RT_BOOL(pThis->fmt_signed); 509 pCfg->Props.cShift = PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(pCfg->Props.cBits, pCfg->Props.cChannels); 510 511 strcpy(pCfg->szName, "Output"); 512 513 sb16CloseOut(pThis); 514 515 int rc = sb16OpenOut(pThis, pCfg); 516 AssertRC(rc); 517 } 518 475 sb16CheckAndReOpenOut(pThis); 519 476 sb16Control(pThis, 1); 520 477 sb16SpeakerControl(pThis, 1); … … 1064 1021 { 1065 1022 LogFlowFuncEnter(); 1066 1067 sb16CloseOut(pThis);1068 1023 1069 1024 pThis->freq = 11025; … … 2012 1967 AssertRCReturn(rc, rc); 2013 1968 2014 #if 02015 PSB16DRIVER pDrv;2016 RTListForEach(&pThis->lstDrv, pDrv, SB16DRIVER, Node)2017 {2018 if (pDrv->Out.pStream)2019 {2020 pDrv->pConnector->pfnCloseOut(pThis->pDrv, pDrv->Out.pStream);2021 pDrv->Out.pStream = NULL;2022 }2023 }2024 #endif2025 2026 1969 if (pThis->dma_running) 2027 1970 { 2028 if (pThis->freq) 2029 { 2030 /* At the moment we only have one stream, the output stream. */ 2031 PPDMAUDIOSTREAMCFG pCfg = &pThis->Out.Cfg; 2032 2033 pCfg->enmDir = PDMAUDIODIR_OUT; 2034 pCfg->DestSource.Dest = PDMAUDIOPLAYBACKDEST_FRONT; 2035 pCfg->enmLayout = PDMAUDIOSTREAMLAYOUT_NON_INTERLEAVED; 2036 2037 pCfg->Props.uHz = pThis->freq; 2038 pCfg->Props.cChannels = 1 << pThis->fmt_stereo; 2039 pCfg->Props.cBits = pThis->fmt_bits; 2040 pCfg->Props.fSigned = RT_BOOL(pThis->fmt_signed); 2041 pCfg->Props.cShift = PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(pCfg->Props.cBits, pCfg->Props.cChannels); 2042 2043 strcpy(pCfg->szName, "Output"); 2044 2045 sb16CloseOut(pThis); 2046 2047 rc = sb16OpenOut(pThis, pCfg); 2048 AssertRC(rc); 2049 } 2050 1971 sb16CheckAndReOpenOut(pThis); 2051 1972 sb16Control(pThis, 1); 2052 1973 sb16SpeakerControl(pThis, pThis->speaker); … … 2165 2086 } 2166 2087 2088 /** 2089 * Checks if the output stream needs to be (re-)created and does so if needed. 2090 * 2091 * @return VBox status code. 2092 * @param pThis SB16 state. 2093 */ 2094 static int sb16CheckAndReOpenOut(PSB16STATE pThis) 2095 { 2096 AssertPtrReturn(pThis, VERR_INVALID_POINTER); 2097 2098 int rc = VINF_SUCCESS; 2099 2100 if (pThis->freq > 0) 2101 { 2102 /* At the moment we only have one stream, the output stream. */ 2103 PDMAUDIOSTREAMCFG Cfg; 2104 RT_ZERO(Cfg); 2105 2106 Cfg.Props.uHz = pThis->freq; 2107 Cfg.Props.cChannels = 1 << pThis->fmt_stereo; 2108 Cfg.Props.cBits = pThis->fmt_bits; 2109 Cfg.Props.fSigned = RT_BOOL(pThis->fmt_signed); 2110 Cfg.Props.cShift = PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(Cfg.Props.cBits, Cfg.Props.cChannels); 2111 2112 if (!DrvAudioHlpPCMPropsAreEqual(&Cfg.Props, &pThis->Out.Cfg.Props)) 2113 { 2114 Cfg.enmDir = PDMAUDIODIR_OUT; 2115 Cfg.DestSource.Dest = PDMAUDIOPLAYBACKDEST_FRONT; 2116 Cfg.enmLayout = PDMAUDIOSTREAMLAYOUT_NON_INTERLEAVED; 2117 2118 strcpy(Cfg.szName, "Output"); 2119 2120 sb16CloseOut(pThis); 2121 2122 rc = sb16OpenOut(pThis, &Cfg); 2123 AssertRC(rc); 2124 } 2125 } 2126 else 2127 sb16CloseOut(pThis); 2128 2129 LogFlowFuncLeaveRC(rc); 2130 return rc; 2131 } 2132 2167 2133 static int sb16OpenOut(PSB16STATE pThis, PPDMAUDIOSTREAMCFG pCfg) 2168 2134 { … … 2175 2141 return VERR_INVALID_PARAMETER; 2176 2142 2177 int rc = VINF_SUCCESS; 2143 int rc = DrvAudioHlpStreamCfgCopy(&pThis->Out.Cfg, pCfg); 2144 if (RT_FAILURE(rc)) 2145 return rc; 2178 2146 2179 2147 PSB16DRIVER pDrv; 2180 2148 RTListForEach(&pThis->lstDrv, pDrv, SB16DRIVER, Node) 2181 2149 { 2182 int rc2 = sb16CreateDrvStream(pThis, pCfg, pDrv);2150 int rc2 = sb16CreateDrvStream(pThis, &pThis->Out.Cfg, pDrv); 2183 2151 if (RT_FAILURE(rc2)) 2184 2152 LogFunc(("Attaching stream failed with %Rrc\n", rc2));
Note:
See TracChangeset
for help on using the changeset viewer.