void openDebugFile() { char path[CCHMAXPATH]; char fileName[CCHMAXPATH+11]; BOOL rc; if (!file) { rc = mciQuerySysValue(MSV_WORKPATH, path); if (rc) { sprintf(fileName,"%s\\mmioFLAC%ld.log",path,time(NULL)); file = fopen(fileName,"wb"); // file = freopen(fileName,"wb",file); } else { exit(-1); } /* endif */ } }
ULONG SetupTempFiles( INSTANCE *ulpInstance, ULONG ulParam1 ) { ULONG ulrc; CHAR TempPath[ CCHMAXPATH ]; // holds path for temp files /********************************************** * Query the default path to place temp files and * pass it on to the IO Proc **********************************************/ ulrc = mciQuerySysValue( MSV_WORKPATH, TempPath ); if ( !ulrc ) { return (MCIERR_INI_FILE); } /***************************************************** * This message illustrates the use of mmioSendMessage: * we are asking the IO Proc that we have loaded to * make all subsequent changes temporary (i.e. if no * save message is sent, then the file will remain in * the original condition. *****************************************************/ ulrc = mmioSendMessage( ulpInstance->hmmio, MMIOM_TEMPCHANGE, ( LONG ) TempPath, 0 ); if (ulrc) { /* Use mmioGetLastError to get additional detail about the error */ ulrc = mmioGetLastError( ulpInstance->hmmio ); /* Cannot write means that the disk is full */ if (ulrc == MMIOERR_CANNOTWRITE ) { return MCIERR_TARGET_DEVICE_FULL; } else { return ( ulrc ); } } /* if there is an error */ /* Flag to indicate that temporary changes are active */ ulpInstance->ulUsingTemp = MCI_TRUE; return ( ulrc ); } /* SetupTempFiles */
void OpenInit( INSTANCE *ulpInstance ) { extern HID hidASource; extern HID hidATarget; extern HID hidBSource; extern HID hidBTarget; ULONG ulrc; ulpInstance->ulCapabilities = CAN_RECORD | CAN_SAVE | CAN_INSERT; /* Stream hid's */ ulpInstance->StreamInfo.hidASource = hidASource; ulpInstance->StreamInfo.hidATarget = hidATarget; ulpInstance->StreamInfo.hidBSource = hidBSource; ulpInstance->StreamInfo.hidBTarget = hidBTarget; /************************************ * Wave Record Defaults. ***********************************/ // SetWaveDeviceDefaults (ulpInstance, MCIDRV_INPUT ); ulpInstance->mmAudioHeader.ulMediaType = MMIO_MEDIATYPE_AUDIO; /*-------------------------------------------- * In case no device is opened, default to * the mode requested in the ini file. *--------------------------------------------*/ // AMPMIX.ulOperation = ulpInstance->lDefaultOperation;// Play or Record /* 6421--instance variable rather than amp instance */ ulpInstance->ulOperation = ulpInstance->lDefaultOperation; STRMSTATE = NO_STATE; /*--------------------------------------------- * The MMPM2.INI file contains two variables that * a streaming MCD should retrieve. The first one * QOS_VALUE (Quality of Service) contains settings * which describe the quality of service that the * network the user is streaming from will try to * support (e.g. GUARANTEED or DONTCARE). If this * quality of service is not available, then another * variable (QOSERRORFLAG) describes whether or not * to notify the caller. *--------------------------------------------------*/ // CONNECTOR FEATURE--can this be moved to DLL init??? ulrc = mciQuerySysValue( MSV_SYSQOSVALUE, &ulpInstance->lQosValue ); if ( !ulrc ) { ulpInstance->lQosValue = DONTRESERVE; } ulrc = mciQuerySysValue( MSV_SYSQOSERRORFLAG, &ulpInstance->lQOSReporting ); if ( !ulrc ) { ulpInstance->lQOSReporting = ERROR_DEFAULT; } } /* OpenInit */
ULONG CheckForValidElement( INSTANCE *ulpInstance, PSZ pszFileName, ULONG ulParam1 ) { ULONG ulrc; // return code ULONG ulPathLength; // Contains the max length LONG lReturnCode; /* Did the caller pass a filename on MCI_OPEN/MCI_LOAD */ if ( pszFileName ) { /* Ensure that this filename is valid */ if (ulrc = CheckMem ( (PVOID) pszFileName, 1, PAG_WRITE)) { return (MCIERR_MISSING_PARAMETER); } /************************************************* * Store the filename for future reference -- i.e. * MCI_INFO can request the name of the file *************************************************/ strcpy ( ulpInstance->pszAudioFile, pszFileName); /************************************************************ * Set flag to say that we did not create a new file--thus * we do not have to clean up if the user doesn't save ************************************************************/ ulpInstance->ulCreatedName = FALSE; } else { /************************************** * if the user requests a read only file * and we must create it, return error **************************************/ if ( ulParam1 & MCI_READONLY ) { return ( MCIERR_MISSING_PARAMETER ); } /********************************************** * Query the default path to place temp files and * generate a temporary file name **********************************************/ ulrc = mciQuerySysValue( MSV_WORKPATH, &ulpInstance->pszAudioFile ); if ( !ulrc ) { return ( MCIERR_INI_FILE ); } ulrc = MCIERR_SUCCESS; ulPathLength = CCHMAXPATH; /* Have mmio generate a unique filename */ lReturnCode = DBCSGenerateUniqueFile( ulpInstance->pszAudioFile, &ulPathLength, &ulpInstance->hTempFile ); if ( lReturnCode != MMIO_SUCCESS ) { return ( MCIERR_FILE_NOT_FOUND ); } /*************************************************** * Because we did create a temporary file we will * be responsible for cleaning up in case the * caller never calls MCI_SAVE (e.g. a bunch of * temp files will be left in the workpath * otherwise, so set a flag to indicate this fact. **************************************************/ ulpInstance->ulCreatedName = TRUE; ObtainDefaults( ulpInstance ); } /* else the user did not pass in a name */ return ( ulrc ); } /* check for valid element */