#include "SOUNDM_AudioDevice_Interface.h" #include "SOUNDM_AudioDevice_LocalCType.h" #include "SOUNDM_Audio_SystemInterface.h" #include "SOUNDM_Audio_PhoneCommand.h" #include "SOUNDM_Audio_NormalInterface.h" #include "ZHWAudioDev.h" #include #include #include #include #include #include #include void *testfunc(SOUNDM_AUDIO_HWDEV_CALLBACK_STATUS_ENUM_T status) { if (status==SOUNDM_AUDIO_STATUS_UNAVAILABLE) { printf("status by func 0 SOUNDM_AUDIO_STATUS_UNAVAILABLE\n"); } else { printf("status by func 0 SOUNDM_AUDIO_STATUS_AVAILABLE\n"); } } void *testfunc1(SOUNDM_AUDIO_HWDEV_CALLBACK_STATUS_ENUM_T status) { if (status==SOUNDM_AUDIO_STATUS_UNAVAILABLE) { printf("status by func 1 SOUNDM_AUDIO_STATUS_UNAVAILABLE\n"); } else { printf("status by func 1 SOUNDM_AUDIO_STATUS_AVAILABLE\n"); } } int dsp16() { int fd, mix; FILE *wav; char filename[30]; unsigned char buf[8*1024]; ssize_t rsize=0, wsize=0, total_size = 0 ; int error; int format = AFMT_S16_LE; int stereo = 1; int rate = 44100; audio_buf_info info; int volume, path=1, mute, channels; int i; fd = open("/dev/dsp16", O_RDONLY); if( fd <= 0 ) { printf("unable open /dev/dsp16 readonly\n"); close(fd); goto out; } printf("open /dev/dsp16 success\n"); wav = fopen("/home/native/dsp16-in.dat", "w+"); if( wav < 0) { printf("can't write open wave file\n"); fclose(wav); goto out; } else { while((rsize = read(fd, buf, 8*1024)) > 0) { printf("rsize=0x%lx\n", rsize); if(fwrite(buf, sizeof(unsigned char), rsize, wav) <0 ) { perror("write to sound.dat failed"); exit(1); } total_size += rsize; if(total_size>8096*2*10) break; } printf("read total size=%lu\n", total_size); } fclose(wav); close(fd); return 0; out: return 1; } int play16rw() { int fd, mix; char filename[30]; unsigned char buf[8*1024]; ssize_t rsize=0, wsize=0, total_size; int error; int format = AFMT_S16_LE; int stereo = 1; int rate = 44100; audio_buf_info info; int volume, path=1, mute, channels; int i; int count; int dsp16 = open("/dev/dsp16",O_RDWR); if( dsp16 <= 0 ) { printf("unable open dsp16 \n"); exit(1); } for(count = 0 ; count < 100 ; count ++) { printf("play count is %d \n",count); if(0>read(dsp16, buf, 4096)) exit(11); if(0>write(dsp16,buf,4096)) exit(123); } close(dsp16); ; } int play16() { int fd, mix; FILE *wav; char filename[30]; unsigned char buf[8*1024]; ssize_t rsize=0, wsize=0, total_size; int error; int format = AFMT_S16_LE; int stereo = 1; int rate = 44100; audio_buf_info info; int volume, path=1, mute, channels; int i; int count; wav = fopen("/home/native/dsp16-in.dat", "r"); if( wav <= 0 ) { printf("unable open /home/native/sound2.dat \n"); exit(1); } int dsp16 = open("/dev/dsp16",O_WRONLY); if( dsp16 <= 0 ) { printf("unable open dsp16 \n"); exit(1); } for(count = 0 ; count < 100 ; count ++) { printf("play count is %d \n",count); if(0>fread(buf,1,4096,wav)) exit(1234); if(0>write(dsp16,buf,4096)) exit(123); } fclose(wav); close(dsp16); ; } void playbackrecorder(SOUNDM_Audio_NormalDevice * pDevice, short * pBuffer) { FILE * fp; int readnum; fp = fopen("recorder.wav","r"); while(feof(fp)!=-1) { readnum = fread(pBuffer,sizeof(short),4096,fp); pDevice->write(pBuffer,readnum); printf("write %d\n",readnum); if(readnum < 4096) break; } fclose(fp); } int main(int argc, char * argv[]) { static int count = 0 ; short * pBuffer = new short[4096]; short pBuf[4096]; unsigned int length = 1024; int retv = 0; int i,j,resu; FILE * fp1; int countMax = 40; int phoneid ; int dsp16 ; int f_read; short data; if (argc != 2) { printf("Usage: %s \n", argv[0]); exit(1); } char * testIndexString = argv[1]; while(* testIndexString != '\0') { switch(* testIndexString ++) { case '1': { SOUNDM_Audio_SystemOutputDevice Normal(SOUNDM_AUDIO_SYSTEMDEV_RINGTONE,8000,2,2); printf("device type %d\n", SOUNDM_AUDIO_SYSTEMDEV_RINGTONE); printf("Play RingTone device!\n"); printf("Normal state is %d\n",Normal.checkDevState()); printf("RINGTONE can write is %d\n",Normal.canWrite()); printf("Normal freq is %d\n",Normal.frequency()); fp1 = fopen("8000_stereo_2.wav","r"); while(feof(fp1)!=-1) { printf("chiq: before fread\n"); f_read = fread(pBuffer,sizeof(short),4096,fp1); printf("chiq: after fread f_read is %d, before write\n", f_read); printf("rtv from write is %d\n", Normal.write(pBuffer,f_read)); if(f_read < 4096) break; } fclose(fp1); Normal.close(); break; } case '2': { SOUNDM_Audio_SystemOutputDevice Level1(SOUNDM_AUDIO_SYSTEMDEV_ALERT,8000,2,2); printf("Play ALERT!\n"); printf("ALERT state is %d\n",Level1.checkDevState()); printf("ALERT can write is %d\n",Level1.canWrite()); fp1 = fopen("8000_stereo_2.wav","r"); while(feof(fp1)!=-1) { f_read = fread(pBuffer,sizeof(short),4096,fp1); if(f_read < 4096) break; Level1.write(pBuffer,f_read); } fclose(fp1); Level1.close(); break; } case '3': { SOUNDM_Audio_SystemOutputDevice Level2(SOUNDM_AUDIO_SYSTEMDEV_PHONE,8000,2,2); printf("Play PHONE!\n"); printf("PHONE state is %d\n",Level2.checkDevState()); printf("PHONE can write is %d\n",Level2.canWrite()); fp1 = fopen("8000_stereo_2.wav","r"); while(feof(fp1)!=-1) { f_read = fread(pBuffer,sizeof(short),4096,fp1); if(f_read < 4096) break; Level2.write(pBuffer,f_read); } fclose(fp1); Level2.close(); break; } case '4': { SOUNDM_Audio_SystemOutputDevice Level3(SOUNDM_AUDIO_SYSTEMDEV_LEVEL3,8000); printf("Play Level3!\n"); printf("Level3 state is %d\n",Level3.checkDevState()); printf("Level3 can write is %d\n",Level3.canWrite()); fp1 = fopen("music1.wav","r"); while(feof(fp1)!=-1) { f_read = fread(pBuffer,sizeof(short),4096,fp1); if(f_read < 4096) break; Level3.write(pBuffer,f_read); } fclose(fp1); Level3.close(); break; } case '5': { printf("Test case 1:\n"); printf("Open a system output device\n"); SOUNDM_Audio_SystemOutputDevice testRingTone(SOUNDM_AUDIO_SYSTEMDEV_PHONE,44100); int DeviceState = testRingTone.checkDevState(); if(DeviceState == 0) { testRingTone.setVolume(2); printf("Open system device successfully!\n"); fp1 = fopen("music1.wav","r"); while(feof(fp1)!=-1) { f_read = fread(pBuffer,sizeof(short),4096,fp1); if(f_read < 4096) break; testRingTone.write(pBuffer,f_read); } fclose(fp1); sleep(2); testRingTone.setVolume(7); testRingTone.setAudioDevice(8000,2,2); fp1 = fopen("music1.wav","r"); while(feof(fp1)!=-1) { f_read = fread(pBuffer,sizeof(short),4096,fp1); if(f_read < 4096) break; testRingTone.write(pBuffer,f_read); } testRingTone.flush(); fclose(fp1); fp1 = fopen("music1.wav","r"); while(feof(fp1)!=-1) { f_read = fread(pBuffer,sizeof(short),4096,fp1); if(f_read < 4096) break; testRingTone.write(pBuffer,f_read); } testRingTone.flush(); fp1 = fopen("music1.wav","r"); while(feof(fp1)!=-1) { f_read = fread(pBuffer,sizeof(short),4096,fp1); if(f_read < 4096) break; testRingTone.write(pBuffer,f_read); } testRingTone.flush(); fclose(fp1); printf("sample is %d\n",testRingTone.frequency()); printf("Test rint tone is opened successfully!\n"); printf("TestRingTone CANwrite return value is %d\n",testRingTone.canWrite()); printf("TestRingTone CANread return value is %d\n",testRingTone.canRead()); if(0==testRingTone.close()) printf("close the system device\n\n"); } else printf("Can not open tesRingTone!\n"); break; } case '6': { SOUNDM_Audio_SystemOutputDevice Alert(SOUNDM_AUDIO_SYSTEMDEV_ALERT,8000); printf("Play a alert!\n"); fp1 = fopen("music1.wav","r"); while(feof(fp1)!=-1) { f_read = fread(pBuffer,sizeof(short),4096,fp1); if(f_read < 4096) break; Alert.write(pBuffer,f_read); } Alert.flush(); fclose(fp1); Alert.close(); break; } case '7': { /*Open normal output device*/ printf("Open normal output device!\n"); SOUNDM_Audio_NormalDevice norSpk1(SOUNDM_AUDIO_NORMALOUT_3,44100); sleep(2); fp1 = fopen("44100_stereo_2.wav","r"); if(0==norSpk1.checkDevState()) { printf("Open normal output device successfully!\n"); printf("lock return is %d\n",norSpk1.lock()); while(feof(fp1)!=-1) { f_read = fread(pBuffer,sizeof(short),4096,fp1); if(f_read < 4096) break; norSpk1.write(pBuffer,f_read); } norSpk1.flush(); } fclose(fp1); /* sleep(2); printf("frequency is %d\n",norSpk1.frequency()); printf("Channel is %d\n",norSpk1.channels()); printf("Bytes perSample is %d\n",norSpk1.bytesPerSample()); printf("Buffer size is %d\n",norSpk1.bufferSize()); printf("bytes written is %d\n",norSpk1.bytesWritten()); printf("Ismute is %d\n",norSpk1.isMuted()); printf("fread is %d\n",f_read); unsigned int volume_r; unsigned int volume_l; bool mute; int sample = norSpk1.frequency(); printf("sample is %d\n",sample); norSpk1.setAudioDevice(8000,2,2); sample = norSpk1.frequency(); printf("sample is %d\n",sample); norSpk1.getVolume(volume_l,volume_r,mute); printf("volume_l is %d\n",volume_l); printf("volume_r is %d\n",volume_r); printf("mute is %d\n",mute); norSpk1.setVolume(10); norSpk1.getVolume(volume_l,volume_r,mute); printf("volume_l is %d\n",volume_l); printf("volume_r is %d\n",volume_r); fp1 = fopen("music1.wav","r"); printf("play volume 10\n"); while(feof(fp1)!=-1) { f_read = fread(pBuffer,sizeof(short),4096,fp1); if(f_read < 4096) break; norSpk1.write(pBuffer,f_read); } fclose(fp1); norSpk1.flush(); norSpk1.setVolume(2); printf("play volume 2\n"); fp1=fopen("music1.wav","r"); while(feof(fp1)!=-1) {engine/SOUNDM_SoundManager_ServerThread.cpp f_read = fread(pBuffer,sizeof(short),4096,fp1); if(f_read < 4096) break; norSpk1.write(pBuffer,f_read); } fclose(fp1); norSpk1.flush(); printf("volumeChanged retv is %d\n",norSpk1.volumeChanged(TRUE)); printf("play with mute is 1\n"); fp1=fopen("music1.wav","r"); while(feof(fp1)!=-1) { f_read = fread(pBuffer,sizeof(short),4096,fp1); if(f_read < 4096) break; norSpk1.write(pBuffer,f_read); } fclose(fp1); norSpk1.flush(); printf("mute is %d\n",mute); norSpk1.setVolume(10); printf("reset mute is 0\n"); fp1=fopen("music1.wav","r"); while(feof(fp1)!=-1) { f_read = fread(pBuffer,sizeof(short),4096,fp1); if(f_read < 4096) break; norSpk1.write(pBuffer,f_read); } fclose(fp1); printf("flush retv is %d\n",norSpk1.flush()); printf("bytesRendered is %d\n",norSpk1.bytesRendered()); printf("unlock return is %d\n",norSpk1.unlock()); printf("ready to close device\n"); if(0==norSpk1.close()) printf("close the normal output device\n"); printf("open device again return is %d\n",norSpk1.open()); printf("close device again return is %d\n",norSpk1.close()); */ break; } case '8': { //Open micinout device SOUNDM_Audio_NormalDevice norMicinout(SOUNDM_AUDIO_MICINOUT); printf("MicInOut device state is %d\n",norMicinout.checkDevState()); printf("MicInOut device can read return is %d\n",norMicinout.canRead()); printf("MicInOut device can write return is %d\n",norMicinout.canWrite()); /* fp1 = fopen("recorder1.wav","w+"); printf("recording begin!\n"); norMicinout.refresh(); int i; for(i=0;i<30;i++) { norMicinout.read(pBuf,4096); fwrite(pBuf,sizeof(short),4096,fp1); } fclose(fp1); printf("record finished!\n"); */ fp1=fopen("8000_mono_2_kn.wav","r"); while(feof(fp1)!=-1) { f_read = fread(pBuffer,sizeof(short),4096,fp1); if(f_read < 4096) break; norMicinout.write(pBuffer,f_read); } fclose(fp1); norMicinout.flush(); printf("norMicinout frequency is %d\n",norMicinout.frequency()); printf("norMicinout close return is %d\n",norMicinout.close()); break; } case '9': { /*Open normal input device*/ printf("Test case 3:\n"); printf("Open normal inputdevice!\n\n"); SOUNDM_Audio_NormalDevice * pNormMic1 = new SOUNDM_Audio_NormalDevice(SOUNDM_AUDIO_MICINPUT); int pNormMic1State = pNormMic1->checkDevState(); printf("check state is %d\n",pNormMic1State); if(pNormMic1State == 0) { printf("Open NormMic1 successfully!\n"); printf("pNormMic1->canRead = %d\n",pNormMic1->canRead()); //pNormMic1->setVolume(10); int j; memset(pBuf,0,4096); printf("\n"); int i; fp1 = fopen("recorder.wav","w+"); printf("recording begin!\n"); for(i=0;i<50;i++) { pNormMic1->read(pBuf,4096); fwrite(pBuf,sizeof(short),4096,fp1); } printf("refresh retv is %d\n",pNormMic1->refresh()); fclose(fp1); if(0==pNormMic1->close()) printf("Close the normal input device!\n"); } delete pNormMic1; /* printf("Test case 4:\n"); SOUNDM_Audio_NormalDevice norSpk2(SOUNDM_AUDIO_NORMALOUT_3,8000,1,2); printf("Can write is %d\n",norSpk2.canWrite()); playbackrecorder(&norSpk2,pBuffer); norSpk2.flush(); printf("play finish and ready to close!\n"); norSpk2.close(); */ break; } case 'j': { SOUNDM_Audio_NormalDevice javamix(SOUNDM_AUDIO_JAVA_MIXDEV,8000); sleep(2); fp1 = fopen("music1.wav","r"); if(0==javamix.checkDevState()) { printf("Open normal output device successfully!\n"); while(feof(fp1)!=-1) { f_read = fread(pBuffer,sizeof(short),4096,fp1); if(f_read < 4096) break; javamix.write(pBuffer,f_read); } } fclose(fp1); javamix.close(); break; } case 'p': { //SOUNDM_Audio_PhoneCommand phoneCommand; // printf("SetDuringVoiceCall rtv is %d\n", phoneCommand.SetDuringVoiceCall(TRUE)); //printf("PhoneConnect rtv is %d\n", phoneCommand.PhoneConnect()); /*Open normal input device*/ printf("Open normal inputdevice!\n\n"); SOUNDM_Audio_NormalDevice * pNormPhone1 = new SOUNDM_Audio_NormalDevice(SOUNDM_AUDIO_PHONEINPUT); int pNormPhone1State = pNormPhone1->checkDevState(); printf("check state is %d\n",pNormPhone1State); if(pNormPhone1State == 0) { printf("Open NormPhone1 successfully!\n"); printf("pNormPhone1->canRead = %d\n",pNormPhone1->canRead()); pNormPhone1->setVolume(10); int j; memset(pBuf,0,4096); printf("\n"); int i; fp1 = fopen("recorder_phoneinput.wav","w+"); printf("recording begin!\n"); for(i=0;i<50;i++) { pNormPhone1->read(pBuf,4096); fwrite(pBuf,sizeof(short),4096,fp1); } printf("refresh retv is %d\n",pNormPhone1->refresh()); fclose(fp1); if(0==pNormPhone1->close()) printf("Close the normal input device!\n"); } delete pNormPhone1; //printf("PhoneClose rtv is %d\n", phoneCommand.PhoneClose()); /* printf("Test case 4:\n"); SOUNDM_Audio_NormalDevice norSpk3(SOUNDM_AUDIO_NORMALOUT_3,8000,1,2); printf("Can write is %d\n",norSpk3.canWrite()); playbackrecorder(&norSpk3,pBuffer); norSpk3.flush(); printf("play finish and ready to close!\n"); norSpk3.close(); */ break; } case 'c': { printf("Phone state!\n"); SOUNDM_Audio_PhoneCommand phoneCommand; printf("SetDuringVoiceCall rtv is %d\n", phoneCommand.SetDuringVoiceCall(TRUE)); printf("PhoneConnect rtv is %d\n", phoneCommand.PhoneConnect()); getchar(); printf("PhoneClose rtv is %d\n", phoneCommand.PhoneClose()); break; } case 'm': { ZHWAudioDev Normal(SOUNDM_AUDIO_FMRADIO); char tempbuff[50000]; tempbuff[0]=23; for (i=1; i<1024; i++) tempbuff[i]=tempbuff[i-1]+1; printf("Normal open is %d\n",Normal.open()); getchar(); printf("device call back init0 is %d\n", Normal.callbackfun_init(testfunc)); getchar(); printf("device call back init1 is %d\n", Normal.callbackfun_init(testfunc1)); getchar(); printf("Normal read is %d\n",Normal.read((char *)tempbuff, 10)); for (i=1; i<10; i++) printf("buf[%d]=%d, ",i,((char *)tempbuff)[i]); printf("\n"); getchar(); printf("device call back init0 is %d\n", Normal.callbackfun_init(testfunc)); getchar(); printf("device call back init1 is %d\n", Normal.callbackfun_init(testfunc1)); getchar(); ((int *)tempbuff)[0]=8; printf("Normal setvolume is %d\n",Normal.dev_ioctl(SOUNDM_AUDIO_HWDEV_CMD_SETVOLUME,(void *)tempbuff)); getchar(); ((int *)tempbuff)[0]=89; printf("Normal getvolume is %d\n",Normal.dev_ioctl(SOUNDM_AUDIO_HWDEV_CMD_GETVOLUME,(void *)tempbuff)); for (i=0; i<3; i++) printf("buf[%d]=%d, ",i,((int *)tempbuff)[i]); printf("\n"); getchar(); /* tempbuff[0]=FMRADIO_LOUDSPEAKER_ON; printf("Normal setpath is %d\n",Normal.dev_ioctl(SOUNDM_AUDIO_HWDEV_CMD_SETPATH,(void *)tempbuff)); getchar(); tempbuff[0]=FMRADIO_LOUDSPEAKER_OFF; printf("Normal setpath is %d\n",Normal.dev_ioctl(SOUNDM_AUDIO_HWDEV_CMD_SETPATH,(void *)tempbuff)); getchar(); */ tempbuff[0]=SOUNDM_SPKPATH_EARPHONEOFF; printf("Normal setpath is %d\n",Normal.dev_ioctl(SOUNDM_AUDIO_HWDEV_CMD_SETPATH,(void *)tempbuff)); getchar(); tempbuff[0]=SOUNDM_SPKPATH_BT_MONO_SPK_OFF; printf("Normal setpath is %d\n",Normal.dev_ioctl(SOUNDM_AUDIO_HWDEV_CMD_SETPATH,(void *)tempbuff)); getchar(); tempbuff[0]=SOUNDM_SPKPATH_HANDSFREE_ON; printf("Normal setpath is %d\n",Normal.dev_ioctl(SOUNDM_AUDIO_HWDEV_CMD_SETPATH,(void *)tempbuff)); getchar(); tempbuff[0]=SOUNDM_SPKPATH_HANDSFREE_OFF; printf("Normal setpath is %d\n",Normal.dev_ioctl(SOUNDM_AUDIO_HWDEV_CMD_SETPATH,(void *)tempbuff)); getchar(); tempbuff[0]=SOUNDM_SPKPATH_HEADSETSPK; printf("Normal setpath is %d\n",Normal.dev_ioctl(SOUNDM_AUDIO_HWDEV_CMD_SETPATH,(void *)tempbuff)); getchar(); tempbuff[0]=SOUNDM_SPKPATH_LOUDSPEAKER; printf("Normal setpath is %d\n",Normal.dev_ioctl(SOUNDM_AUDIO_HWDEV_CMD_SETPATH,(void *)tempbuff)); getchar(); tempbuff[0]=SOUNDM_SPKPATH_SPEAKPHONE; printf("Normal setpath is %d\n",Normal.dev_ioctl(SOUNDM_AUDIO_HWDEV_CMD_SETPATH,(void *)tempbuff)); getchar(); tempbuff[0]=SOUNDM_SPKPATH_CARKITSPK; printf("Normal setpath is %d\n",Normal.dev_ioctl(SOUNDM_AUDIO_HWDEV_CMD_SETPATH,(void *)tempbuff)); getchar(); tempbuff[0]=SOUNDM_SPKPATH_HEADJACK; printf("Normal setpath is %d\n",Normal.dev_ioctl(SOUNDM_AUDIO_HWDEV_CMD_SETPATH,(void *)tempbuff)); getchar(); tempbuff[0]=SOUNDM_SPKPATH_HEADSET_STEREOSPK; printf("Normal setpath is %d\n",Normal.dev_ioctl(SOUNDM_AUDIO_HWDEV_CMD_SETPATH,(void *)tempbuff)); getchar(); tempbuff[0]=SOUNDM_SPKPATH_HANDSET_SPK; printf("Normal setpath is %d\n",Normal.dev_ioctl(SOUNDM_AUDIO_HWDEV_CMD_SETPATH,(void *)tempbuff)); getchar(); tempbuff[0]=SOUNDM_SPKPATH_HANDSET_SPK; printf("Normal setpath is %d\n",Normal.dev_ioctl(SOUNDM_AUDIO_HWDEV_CMD_SETPATH,(void *)tempbuff)); getchar(); tempbuff[0]=SOUNDM_SPKPATH_CARKIT_SPK; printf("Normal setpath is %d\n",Normal.dev_ioctl(SOUNDM_AUDIO_HWDEV_CMD_SETPATH,(void *)tempbuff)); getchar(); tempbuff[0]=SOUNDM_SPKPATH_HEADSET_MONOSPK; printf("Normal setpath is %d\n",Normal.dev_ioctl(SOUNDM_AUDIO_HWDEV_CMD_SETPATH,(void *)tempbuff)); getchar(); tempbuff[0]=SOUNDM_SPKPATH_BT_MONO_SPK; printf("Normal setpath is %d\n",Normal.dev_ioctl(SOUNDM_AUDIO_HWDEV_CMD_SETPATH,(void *)tempbuff)); getchar(); tempbuff[0]=SOUNDM_SPKPATH_BT_STEREO_SPK; printf("Normal setpath is %d\n",Normal.dev_ioctl(SOUNDM_AUDIO_HWDEV_CMD_SETPATH,(void *)tempbuff)); getchar(); tempbuff[0]=SOUNDM_SPKPATH_EMUEARPHONE_SPK; printf("Normal setpath is %d\n",Normal.dev_ioctl(SOUNDM_AUDIO_HWDEV_CMD_SETPATH,(void *)tempbuff)); getchar(); tempbuff[0]=SOUNDM_SPKPATH_EMUSTEREO_SPK; printf("Normal setpath is %d\n",Normal.dev_ioctl(SOUNDM_AUDIO_HWDEV_CMD_SETPATH,(void *)tempbuff)); getchar(); tempbuff[0]=SOUNDM_SPKPATH_3MM5MOTO_SPK; printf("Normal setpath is %d\n",Normal.dev_ioctl(SOUNDM_AUDIO_HWDEV_CMD_SETPATH,(void *)tempbuff)); getchar(); tempbuff[0]=SOUNDM_SPKPATH_3MM5STER_SPK; printf("Normal setpath is %d\n",Normal.dev_ioctl(SOUNDM_AUDIO_HWDEV_CMD_SETPATH,(void *)tempbuff)); getchar(); printf("Normal getstatus is %d\n",Normal.dev_ioctl(SOUNDM_AUDIO_HWDEV_CMD_GETSTATUS,(void *)tempbuff)); printf("status = %d\n", tempbuff[0]); getchar(); printf("Normal write is %d\n",Normal.write((char *)tempbuff, 20)); getchar(); printf("Normal close is %d\n",Normal.close()); return 1; } case 'k': printf("Press any key to continue...\n"); getchar(); break; default: printf("Wrong command.\n"); printf("Press any key to continue...\n"); getchar(); break; } } delete pBuffer; }