Esempio n. 1
0
int vmsStartRecord(VmsPlayRecordType *vmsP)
{
	int er;
		vmsP->playRecordObj = gsm_create();
		SetAudioTypeLocal(0,2);//record 
		vmsP->aqRecordPlayPcm = InitAudio(vmsP, CallBackVmsUI, CallBackVmsSoundPCM);//playback
		if(CreateSoundThread(false,vmsP->aqRecordPlayPcm,false,0))
		{
			DeInitAudio( vmsP->aqRecordPlayPcm,false);
			vmsP->aqRecordPlayPcm = 0;
			return 1;
			
		}
		else
		{	
			er = PlayAudio(vmsP->aqRecordPlayPcm);
			if(er)
			{	
				DeInitAudio( vmsP->aqRecordPlayPcm,true);
				vmsP->aqRecordPlayPcm = 0;
			
			}	
			return er;
		}	
	
	
}
Esempio n. 2
0
int openSoundInterface(void *udata,int isFullDuplex)
{
	LtpInterfaceType *ltpInterfaceP;
	ltpInterfaceP = (LtpInterfaceType *)udata;
	if(ltpInterfaceP->ltpObjectP->sipOnB || ltpInterfaceP->playbackP ||ltpInterfaceP->stopAutioQueueImidateB==true)
	{
		return 0;
	}
	ltpInterfaceP->holdB = false;
	DeInitAudio( ltpInterfaceP->playbackP,false);
	DeInitAudio( ltpInterfaceP->recordP,false);
	ltpInterfaceP->playbackP = 0;
	ltpInterfaceP->recordP = 0;
	SetAudioTypeLocal(ltpInterfaceP,0);//record as well as play back
	ltpInterfaceP->playbackP = InitAudio(ltpInterfaceP, CallBackUI, 0);//playback
	if(CreateSoundThread(true,ltpInterfaceP->playbackP,false,0))
	{
		DeInitAudio( ltpInterfaceP->playbackP,false);
		ltpInterfaceP->playbackP = 0;

	}
	
	ltpInterfaceP->recordP = InitAudio(ltpInterfaceP, CallBackUI, CallBackSoundPCM);
	
	if(CreateSoundThread(false,ltpInterfaceP->recordP,false,ltpInterfaceP->ltpObjectP->soundBlockSize*2))
	{
		  DeInitAudio( ltpInterfaceP->recordP,false);
		  ltpInterfaceP->recordP = 0;
			  
		  
	}  
	PlayAudio(ltpInterfaceP->recordP);
	//sleep(10);
	PlayAudio(ltpInterfaceP->playbackP);
	//PlayAudio(ltpInterfaceObjectP->recordP);
	
	return 0;
}
Esempio n. 3
0
int vmsStartPlay(VmsPlayRecordType *vmsP)
{
	vmsP->playRecordObj = gsm_create();
	SetAudioTypeLocal(0,1);// play back
	SetSpeakerOnOrOff(0, 1);
	vmsP->aqRecordPlayPcm = InitAudio(vmsP, CallBackVmsUI, CallBackVmsSoundPCM);//playback
	if(CreateSoundThread(true,vmsP->aqRecordPlayPcm,false,0))
	{
		DeInitAudio( vmsP->aqRecordPlayPcm,false);
		vmsP->aqRecordPlayPcm = 0;
		return 1;
	}
	else
	{	
		//vmsP->aqRecordPlayPcm->playStartedB = true;
		PlayBuffStart(vmsP->aqRecordPlayPcm);
		PlayAudio(vmsP->aqRecordPlayPcm);
		return 0;
		
		
	}	
	
	
}
Esempio n. 4
0
MMRESULT
CreateSoundDeviceInstance(
    IN  PSOUND_DEVICE SoundDevice,
    OUT PSOUND_DEVICE_INSTANCE* SoundDeviceInstance)
{
    MMRESULT Result;
    PMMFUNCTION_TABLE FunctionTable;

    SND_TRACE(L"Creating a sound device instance\n");

    VALIDATE_MMSYS_PARAMETER( IsValidSoundDevice(SoundDevice) );
    VALIDATE_MMSYS_PARAMETER( SoundDeviceInstance != NULL );

    Result = AllocateSoundDeviceInstance(SoundDeviceInstance);

    if ( ! MMSUCCESS(Result) )
        return TranslateInternalMmResult(Result);

    /* Get the "open" routine from the function table, and validate it */
    Result = GetSoundDeviceFunctionTable(SoundDevice, &FunctionTable);
    if ( ! MMSUCCESS(Result) )
    {
        FreeSoundDeviceInstance(*SoundDeviceInstance);
        return TranslateInternalMmResult(Result);
    }

    if ( FunctionTable->Open == NULL )
    {
        FreeSoundDeviceInstance(*SoundDeviceInstance);
        return MMSYSERR_NOTSUPPORTED;
    }

    /* Set up the members of the structure */
    (*SoundDeviceInstance)->Next = NULL; 
    (*SoundDeviceInstance)->Device = SoundDevice;
    (*SoundDeviceInstance)->Handle = NULL;
    (*SoundDeviceInstance)->Thread = NULL;

    (*SoundDeviceInstance)->WinMM.Handle = INVALID_HANDLE_VALUE;
    (*SoundDeviceInstance)->WinMM.ClientCallback = 0;
    (*SoundDeviceInstance)->WinMM.ClientCallbackInstanceData = 0;
    (*SoundDeviceInstance)->WinMM.Flags = 0;

    /* Initialise the members of the struct used by the sound thread */
    (*SoundDeviceInstance)->HeadWaveHeader = NULL;
    (*SoundDeviceInstance)->TailWaveHeader = NULL;

    (*SoundDeviceInstance)->OutstandingBuffers = 0;

    (*SoundDeviceInstance)->LoopsRemaining = 0;

    /* Create the streaming thread (TODO - is this for wave only?) */
    Result = CreateSoundThread(&(*SoundDeviceInstance)->Thread);
    if ( ! MMSUCCESS(Result) )
    {
        FreeSoundDeviceInstance(*SoundDeviceInstance);
        return TranslateInternalMmResult(Result);
    }

    /* Add the instance to the list */
    Result = ListSoundDeviceInstance(SoundDevice, *SoundDeviceInstance);
    if ( ! MMSUCCESS(Result) )
    {
        FreeSoundDeviceInstance(*SoundDeviceInstance);
        return TranslateInternalMmResult(Result);
    }

    /* Try and open the device */
    Result = FunctionTable->Open(SoundDevice, (&(*SoundDeviceInstance)->Handle));
    if ( ! MMSUCCESS(Result) )
    {
        UnlistSoundDeviceInstance(*SoundDeviceInstance);
        FreeSoundDeviceInstance(*SoundDeviceInstance);
        return TranslateInternalMmResult(Result);
    }

    return MMSYSERR_NOERROR;
}