MFC Sample NOTES:
To run the MFC sample code, you need to compile the project, but you will also need to copy the xaudio runtime DLL (xaudio.dll found in lib\dynamic) to the directory where your exectuable will be (Usually in the 'Debug' subdirectory of the MFC sample code directory. You can also choose to copy the xaudio.dll to the Windows System directory.
When using the ASYNC API under Windows, the call to player_new() will spawn a separate thread for the decoding. Message exchange between the controlling application and the player is done though the standard Windows Message Queues.
The caller can specifiy if it wants messages sent back from the player to be delivered to a window's message handler or to the thread's message queue. If the argument to player_new() is NULL, then messages will be posted back to the calling thread's message queue. If the parameter is a pointer to an HWND variable that contains the Window Handle of a window that has been created, then messages will be posted to that window's message handler.Example:
player_new((void**)&Player.dthread, (void*)&m_hWnd);
To use the Delphi Interface, you need to install the XaudioPlayer component.
FIRST you need to copy the xaudio runtime DLL (xaudio.dll found in lib\dynamic) to a directory that is in your library search path (look at the PATH environment variable). We recommend that you put it in Borland\Delphi 3\Bin which should be included in your search path (you could also copy xaudio.dll to the Windows System directory, but it could conflict with existing version of xaudio.dll with a different API version). If xaudio.dll is not in your path, you will get an error message when trying to install the component.
Also, remember to include xaudio.dll with your application if you need to distribute it (in that case, the best is to put the xaudio.dll file in the same directory as your application's executable).
Use the 'Install component' menu. This will prompt you for the filename of the component ('Unit file name'), and which package to install it into ('Package file name'). If you want to install it into an existing package, choose the 'Into existing package' tab, and you can typically install it into the "user" package found under Borland\Delphi 3\Lib\Dclusr30.dpl (Delphi 3.0). If you want to install it into a new package, choose the 'Into new package' tab and you will be prompted for the location and name of the package you want to create (remember that you need to add th elocation of that package to your search path before you can use it). Once you have selected the package you want to install the component into, select the 'Unit filename', which is the file 'XaudioPlayer.pas' found in the lib\delphi directory.
The component file is XaudioPlayer.pas found under lib\delphi in the SDK distribution. Once you have installed the component, it will appear on your component panel, int a category named 'Xaudio'. A small icon with a red X over a black circle will show the component.
When using the ASYNC API under Unix, the call to player_new() will fork a separate process for the decoding. Message exchange between the controlling application and the player is done though a pipe. If the controlling application wants to install a notifier function that is called when messages are being sent back from the player (Typically an X Windows application will want to do that, so that the main X loop will call the notification function when data arrives on the message queue), it can read the file descriptior of the pipe.
For that, it will need to include the file control_pipe.h and cast the player pointer to an XA_PipeControl structure, which contains the file descriptor of the pipe.Example:
input_id = XtAppAddInput(app_context, player->command_read_pipe, (XtPointer) XtInputReadMask, PipeInputCB, NULL);