int jjmain ( int argc, char *argv[] ) { VoiceInitToken(); Mp3Init(); pthread_t threadVoice; pthread_t threadMain; pthread_t threadCom; // pthread_create ( &threadMain, NULL, MainLoop, NULL ); // pthread_create ( &threadCom, NULL, ComThread, NULL ); pthread_create ( &threadVoice, NULL, VoicecmdThread, NULL ); // GetVoiceInput(); // char *voice = malloc( strlen( "任务完成" ) + 1 ); // strcpy( voice, "任务完成" ); // VoiceGet( voice ); // // Mp3Play( VOICEDIR ); getchar(); endSignal = 1; pthread_join ( threadVoice, NULL ); // pthread_join ( threadMain, NULL ); // pthread_join ( threadCom, NULL ); Mp3Free(); return 0; }
/* Mp3_Ioctl - Ioctl function for driver */ INT8U Mp3_Ioctl(INT8U DeviceIndex, PVOID pContext, INT8U Control, PVOID pBuffer, INT32U* pCount) { INT8U err = OS_DRV_NO_ERR; if (DeviceIndex >= MP3_DEVICE_COUNT) { // someone passed us a bogus device DEBUGMSG(TRUE, ("MP3_DRV attempt to Ioctl bad device index: 0x%X\n\r", DeviceIndex)); return OS_DRV_NO_DEVICE; } // determine which Control code is being used switch(Control) { // set SPI handle and initilaize device case IOCTL_MP3_SET_SPI: // make sure we have enough room in the input buffer if (*pCount != sizeof(HANDLE)) { return OS_DRV_BUFFER_SIZE; } err = Mp3Init((PMP3_EXT)pContext, *((HANDLE *)pBuffer)); if (err == OS_DRV_NO_ERR) { ((PMP3_EXT)pContext)->hSpi = *((HANDLE *)pBuffer); } // set the return length equal to the amount of data returned *pCount = 0; break; case IOCTL_MP3_SET_DATA_MODE: // make sure we have enough room in the input buffer if (*pCount != sizeof(INT32U)) { return OS_DRV_BUFFER_SIZE; } (((PMP3_EXT)pContext))->DataMode = (BOOLEAN)*(INT32U *)pBuffer; // set the return length equal to the amount of data returned *pCount = 0; break; default: // we don't know this control code // set the return length equal to the amount of data returned if (pCount != NULL) { *pCount = 0; } return OS_DRV_UNSUPPORTED; } return err; }
BOOL KMp3Music::Open(LPSTR FileName) { if (!FileName || !FileName[0]) return FALSE; if (m_mp3buffer || m_pMp3File) Close(); if (!Mp3FileOpen(FileName)) return FALSE; if (!Mp3Init()) return FALSE; if (!Init()) return FALSE; return TRUE; }