The following code illustrates how to create a data stream from the file system to the digital audio card.
#define INCL_ERRORS #include "os2.h" #include "os2me.h" #include "mcd.h" #include "audio.h" ULONG ulRC; /* Error return code */ HID hidSource; /* Source handler ID */ HSTREAM hStream; /* Stream handle */ HMMIO hmmioIn; /* Handle to MMIO file */ ACB_MMIO acb; /* Associate control */ /* block used to /* /* Associate the file to */ /* stream (play) */ SZ RecordFileName[260] = {"d:\mmos2 \data\mumme.wav"}; . . . /*-----------------------------------------------------------*/ /* Create a data stream from the file system to the digital */ /* connected to the speakers. (See SpiCreateStream.) */ /*-----------------------------------------------------------*/ . . . /*-------------------------------------------------------*/ /* USE MMIO to access a digital audio object. */ /*-------------------------------------------------------*/ if ((hmmioIn = mmioOpen(PlayFileName, NULL, MMIO_READWRITE| MMIO_DENYNONE))== NULL) return(ERROR_FILE_NOT_FOUND); /* error! */ /*--------------------------------------------------------*/ /* Fill in acb with data object information. */ /*--------------------------------------------------------*/ acb.ulACBLen = sizeof(ACB_MMIO); acb.ulObjType = ACBTYPE_MMIO; acb.hmmio = hmmioIn; /*--------------------------------------------------------------------*/ /* Associate the digital audio data object with the source handler. */ /*--------------------------------------------------------------------*/ if (ulRC = SpiAssociate (hStream, hidSource, (PACB)&acb)) return (ulRC);