Post Reply 
 
Thread Rating:
  • 29 Votes - 2.86 Average
  • 1
  • 2
  • 3
  • 4
  • 5
XAudio2 upmixing matrices
Author Message
spacy51 Offline
VBA-M Developer
*******

Posts: 451
Joined: Mar 2008
Reputation: 3
Post: #1
XAudio2 upmixing matrices
Hey there, I just added the feature to upmix the GB's/GBA's stereo sound to the number of speakers which are attached to the souncard.

I took this inof sheet as a reference:
http://ac3filter.net/guides/mixing_matrix

And this for the speaker order:
http://msdn.microsoft.com/en-us/library/bb694506.aspx


Here are my matrices. Since I entered them by hand, it would be good if everyone who is into that stuff could tell me if they're good.
Is it OK if I leave the LFE always at 0 since it would receive frequencies higher than for ex. 120Hz?
I can still hear my LFE because my sound driver uses a crossover frequency to get the subwoofer signal from the low-freq part of the other channels.

PHP Code:
#ifdef STEREO_UPMIXING
    // set up stereo upmixing
    
XAUDIO2_DEVICE_DETAILS dd;
    
ZeroMemory( &ddsizeofdd ) );
    
hr xaud->GetDeviceDetails0, &dd );
    
ASSERThr == S_OK );
    
float *matrix NULL;
    
matrix = (float*)mallocsizeof( float ) * dd.OutputFormat.Format.nChannels );
    switch( 
dd.OutputFormat.Format.nChannels ) {
        case 
4// 4.0
//Speaker \ Left Source           Right Source
/*Front L*/    
matrix[0] = 1.0000f;  matrix[1] = 0.0000f;
/*Front R*/    matrix[2] = 0.0000f;  matrix[3] = 1.0000f;
/*Back  L*/    matrix[4] = 1.0000f;  matrix[5] = 0.0000f;
/*Back  R*/    matrix[6] = 0.0000f;  matrix[7] = 1.0000f;
            break;
        case 
5// 5.0
//Speaker \ Left Source           Right Source
/*Front L*/    
matrix[0] = 1.0000f;  matrix[1] = 0.0000f;
/*Front R*/    matrix[2] = 0.0000f;  matrix[3] = 1.0000f;
/*Front C*/    matrix[4] = 0.7071f;  matrix[5] = 0.7071f;
/*Side  L*/    matrix[6] = 1.0000f;  matrix[7] = 0.0000f;
/*Side  R*/    matrix[8] = 0.0000f;  matrix[9] = 1.0000f;
            break;
        case 
6// 5.1
//Speaker \ Left Source           Right Source
/*Front L*/    
matrix[0] = 1.0000f;  matrix[1] = 0.0000f;
/*Front R*/    matrix[2] = 0.0000f;  matrix[3] = 1.0000f;
/*Front C*/    matrix[4] = 0.7071f;  matrix[5] = 0.7071f;
/*LFE    */    matrix[6] = 0.0000f;  matrix[7] = 0.0000f;
/*Side  L*/    matrix[8] = 1.0000f;  matrix[9] = 0.0000f;
/*Side  R*/    matrix[10] = 0.0000f;  matrix[11] = 1.0000f;
            break;
        case 
7// 6.1
//Speaker \ Left Source           Right Source
/*Front L*/    
matrix[0] = 1.0000f;  matrix[1] = 0.0000f;
/*Front R*/    matrix[2] = 0.0000f;  matrix[3] = 1.0000f;
/*Front C*/    matrix[4] = 0.7071f;  matrix[5] = 0.7071f;
/*LFE    */    matrix[6] = 0.0000f;  matrix[7] = 0.0000f;
/*Side  L*/    matrix[8] = 1.0000f;  matrix[9] = 0.0000f;
/*Side  R*/    matrix[10] = 0.0000f;  matrix[11] = 1.0000f;
/*Back  C*/    matrix[12] = 0.7071f;  matrix[13] = 0.7071f;
            break;
        case 
8// 7.1
//Speaker \ Left Source           Right Source
/*Front L*/    
matrix[0] = 1.0000f;  matrix[1] = 0.0000f;
/*Front R*/    matrix[2] = 0.0000f;  matrix[3] = 1.0000f;
/*Front C*/    matrix[4] = 0.7071f;  matrix[5] = 0.7071f;
/*LFE    */    matrix[6] = 0.0000f;  matrix[7] = 0.0000f;
/*Back  L*/    matrix[8] = 1.0000f;  matrix[9] = 0.0000f;
/*Back  R*/    matrix[10] = 0.0000f;  matrix[11] = 1.0000f;
/*Side  L*/    matrix[12] = 1.0000f;  matrix[13] = 0.0000f;
/*Side  R*/    matrix[14] = 0.0000f;  matrix[15] = 1.0000f;
            break;
    }
    
hr sVoice->SetOutputMatrixNULL2dd.OutputFormat.Format.nChannelsmatrix );
    
ASSERThr == S_OK );
    
freematrix );
    
matrix NULL;
#endif 
(This post was last modified: 07-15-2008 03:47 AM by spacy51.)
07-15-2008 03:45 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Squall Leonhart Offline
The Admin with the Gunblade
*******

Posts: 1,475
Joined: Mar 2008
Reputation: 15
Post: #2
RE: XAudio2 upmixing matrices
LFE crossmixing should be made adjustable, as not all sound drivers mix LFE channels.

my main pc's Logitech Z640 and creative SB Live make a virtual surround already, though since i've been gaming on my other pc lately, i use my HTS's DPLII mixing.

07-15-2008 05:22 PM
Visit this user's website Find all posts by this user Quote this message in a reply
spacy51 Offline
VBA-M Developer
*******

Posts: 451
Joined: Mar 2008
Reputation: 3
Post: #3
RE: XAudio2 upmixing matrices
Well, the problem is I have no idea if setting up a crossover frequency is possible with XAudio2.


Squall Leonhart Wrote:LFE crossmixing should be made adjustable, as not all sound drivers mix LFE channels.

my main pc's Logitech Z640 and creative SB Live make a virtual surround already, though since i've been gaming on my other pc lately, i use my HTS's DPLII mixing.
07-15-2008 08:50 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Squall Leonhart Offline
The Admin with the Gunblade
*******

Posts: 1,475
Joined: Mar 2008
Reputation: 15
Post: #4
RE: XAudio2 upmixing matrices
you should totally make an Xaudio plugin for Project64 Tongue

07-15-2008 10:15 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)

 Quick Theme: