Ticket #8289: 8289-ao_win_51.patch

File 8289-ao_win_51.patch, 2.2 KB (added by Jeff Lu <jll544@…>, 14 years ago)
  • libs/libmyth/audiooutputdx.cpp

     
    506506        if (size == 0)
    507507        return;
    508508
    509     if (audio_channels == 6)
    510     {
    511         // Linux and Windows have different 5.1 channel order conventions
    512         const uint kReorder[6] = {0,1,4,5,2,3};
    513         int abytes = audio_bits / 8;
    514         unsigned char p_tmp[24];
    515         unsigned char *obuf = buffer;
    516         for(int i = 0; i < size / audio_channels / abytes; i++)
    517         {
    518             for(int j = 0; j < audio_channels; j++)
    519             {
    520                 for(int k = 0; k < abytes; k++)
    521                 {
    522                     p_tmp[abytes * kReorder[j] + k] = buffer[abytes * j + k];
    523                 }
    524             }
    525             memcpy(buffer, p_tmp, abytes * audio_channels);
    526             buffer += abytes * audio_channels;
    527         }
    528         buffer = obuf;
    529     }
    530 
    531509    m_priv->FillBuffer(buffer, size);
    532510    if (!pauseaudio)
    533511        m_priv->StartPlayback();
  • libs/libmyth/audiooutputwin.cpp

     
    218218    if (size == 0)
    219219        return;
    220220
    221     if (audio_channels == 6)
    222     {
    223         // Linux and Windows have different 5.1 channel order conventions
    224         const uint kReorder[6] = {0,1,4,5,2,3};
    225         int abytes = audio_bits / 8;
    226         unsigned char p_tmp[24];
    227         unsigned char *obuf = buffer;
    228         for(int i = 0; i < size / audio_channels / abytes; i++)
    229         {
    230             for(int j = 0; j < audio_channels; j++)
    231             {
    232                 for(int k = 0; k < abytes; k++)
    233                 {
    234                     p_tmp[abytes * kReorder[j] + k] = buffer[abytes * j + k];
    235                 }
    236             }
    237             memcpy(buffer, p_tmp, abytes * audio_channels);
    238             buffer += abytes * audio_channels;
    239         }
    240         buffer = obuf;
    241     }
    242 
    243221    if (InterlockedIncrement(&m_nPkts) > kPacketCnt)
    244222    {
    245223        while (m_nPkts > kPacketCnt)