baseport/syborg/soundsc/shared_txsound.cpp
author John Kern <johnk@symbian.org>
Thu, 12 Nov 2009 14:39:23 -0800
changeset 22 3bf560f85513
parent 18 0b7d3b28f025
child 23 8374da225e88
permissions -rw-r--r--
fix for bug 877
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
16
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
     1
/*
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
     3
* All rights reserved.
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
     5
* under the terms of the License "Eclipse Public License v1.0"
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
     8
*
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
     9
* Initial Contributors:
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    11
*
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    12
* Contributors:
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    13
*
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    14
* Description:
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    15
*
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    16
*/
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    17
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    18
#include "shared_sound.h"
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    19
#include "variant_sound.h"
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    20
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    21
void TimerCallback(TAny* aData)
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    22
	{
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    23
	DDriverSyborgSoundScPdd * soundscpdd = (DDriverSyborgSoundScPdd*) aData;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    24
		
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    25
	soundscpdd->Callback(soundscpdd->iTransferArray[0].iTransferID, KErrNone, soundscpdd->iTransferArray[0].iNumBytes);
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    26
	
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    27
	}
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    28
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    29
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    30
DDriverSyborgSoundScPdd::DDriverSyborgSoundScPdd() : iTimer(TimerCallback,this)
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    31
	{
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    32
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    33
	}
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    34
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    35
DDriverSyborgSoundScPdd::~DDriverSyborgSoundScPdd()
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    36
	{
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    37
	iTimer.Cancel();
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    38
	}
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    39
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    40
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    41
TInt DDriverSyborgSoundScPdd::DoCreate()
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    42
	{
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    43
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    44
	SetCaps();
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    45
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    46
	SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPdd::DoCreate TxPdd");
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    47
	
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    48
	return KErrNone;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    49
	}
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    50
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    51
void DDriverSyborgSoundScPdd::GetChunkCreateInfo(TChunkCreateInfo& aChunkCreateInfo)
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    52
	{
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    53
	SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPdd::GetChunkCreateInfo TxPdd");
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    54
	
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    55
	aChunkCreateInfo.iType = TChunkCreateInfo::ESharedKernelMultiple;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    56
	aChunkCreateInfo.iMapAttr = EMapAttrFullyBlocking; 	// No caching
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    57
	aChunkCreateInfo.iOwnsMemory = ETrue; 				// Using RAM pages
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    58
	aChunkCreateInfo.iDestroyedDfc = NULL; 				// No chunk destroy DFC
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    59
	}
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    60
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    61
void DDriverSyborgSoundScPdd::Caps(TDes8& aCapsBuf) const
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    62
	{
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    63
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    64
	SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPdd::Caps TxPdd");
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    65
	
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    66
	// Fill the structure with zeros in case it is a newer version than we know about
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    67
	aCapsBuf.FillZ(aCapsBuf.MaxLength());
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    68
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    69
	// And copy the capabilities into the packaged structure
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    70
	TPtrC8 ptr((const TUint8*) &iCaps, sizeof(iCaps));
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    71
	aCapsBuf = ptr.Left(Min(ptr.Length(), aCapsBuf.MaxLength()));
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    72
	}
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    73
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    74
TInt DDriverSyborgSoundScPdd::SetConfig(const TDesC8& aConfigBuf)
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    75
	{
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    76
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    77
	SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPdd::SetConfig TxPdd");
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    78
	
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    79
	// Read the new configuration from the LDD
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    80
	TCurrentSoundFormatV02 config;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    81
	TPtr8 ptr((TUint8*) &config, sizeof(config));
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    82
	Kern::InfoCopy(ptr, aConfigBuf);
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    83
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    84
	iConfig = config;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    85
	
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    86
	return KErrNone;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    87
	}
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    88
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    89
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    90
TInt DDriverSyborgSoundScPdd::SetVolume(TInt aVolume)
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    91
	{
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    92
	
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    93
	SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPdd::Setvolume TxPdd");
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    94
	
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    95
	return KErrNone;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    96
	}
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    97
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    98
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    99
TInt DDriverSyborgSoundScPdd::StartTransfer()
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   100
	{
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   101
	
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   102
	SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPdd::starttransfer TxPdd");
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   103
	
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   104
	//Prepare for transfer
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   105
	return KErrNone;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   106
	
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   107
	}
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   108
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   109
TInt DDriverSyborgSoundScPdd::CalculateBufferTime(TInt aNumBytes)
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   110
	{
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   111
	
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   112
	TUint samplerate=0;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   113
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   114
	// Let the compiler perform an integer division of rates
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   115
	switch(iConfig.iRate)
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   116
		{
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   117
		case ESoundRate7350Hz: 	samplerate = 7350; break;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   118
		case ESoundRate8000Hz: 	samplerate = 8000; break;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   119
		case ESoundRate8820Hz: 	samplerate = 8820; break;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   120
		case ESoundRate9600Hz: 	samplerate = 9600; break;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   121
		case ESoundRate11025Hz: samplerate = 11025; break;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   122
		case ESoundRate12000Hz: samplerate = 12000; break;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   123
		case ESoundRate14700Hz:	samplerate = 14700; break;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   124
		case ESoundRate16000Hz: samplerate = 16000; break;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   125
		case ESoundRate22050Hz: samplerate = 22050; break;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   126
		case ESoundRate24000Hz: samplerate = 24000; break;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   127
		case ESoundRate29400Hz: samplerate = 29400; break;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   128
		case ESoundRate32000Hz: samplerate = 32000; break;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   129
		case ESoundRate44100Hz: samplerate = 44100; break;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   130
		case ESoundRate48000Hz: samplerate = 48000; break;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   131
		}
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   132
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   133
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   134
	// integer division by number of channels
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   135
	aNumBytes /= iConfig.iChannels;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   136
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   137
	SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPdd::iChannels =%d", iConfig.iChannels);
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   138
	SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPdd::iEncoding =%d", iConfig.iEncoding);
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   139
	
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   140
	// integer division by bytes per sample
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   141
	switch(iConfig.iEncoding)
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   142
		{
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   143
		case ESoundEncoding8BitPCM: break;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   144
		case ESoundEncoding16BitPCM: aNumBytes /= 2; break;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   145
		case ESoundEncoding24BitPCM: aNumBytes /= 3; break;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   146
		}
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   147
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   148
	return (aNumBytes * 1000) / samplerate; //return time in milliseconds
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   149
	
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   150
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   151
	}
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   152
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   153
TInt DDriverSyborgSoundScPdd::TransferData(TUint aTransferID, TLinAddr aLinAddr, TPhysAddr /*aPhysAddr*/, TInt aNumBytes)
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   154
	{
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   155
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   156
	//function wil get called multiple times while transfer is in progress therefore keep fifo queue of requests
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   157
	TTransferArrayInfo transfer;	
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   158
		
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   159
	transfer.iTransferID = aTransferID;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   160
	transfer.iLinAddr = aLinAddr;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   161
	transfer.iNumBytes = aNumBytes;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   162
	
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   163
	//calculate the amount of time required to play/record buffer
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   164
	TInt buffer_play_time = CalculateBufferTime(aNumBytes);
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   165
	TInt timerticks = NKern::TimerTicks(buffer_play_time);
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   166
	transfer.iPlayTime = timerticks;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   167
	
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   168
	iTransferArray.Append(transfer);
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   169
	
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   170
	//Timer will callback when correct time has elapsed, will return KErrInUse if transfer
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   171
	//already active, this is ok becuase will be started again in callback
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   172
	TInt err = iTimer.OneShot(timerticks, ETrue);
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   173
	
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   174
	
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   175
	return KErrNone;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   176
	}
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   177
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   178
void DDriverSyborgSoundScPdd::StopTransfer()
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   179
	{
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   180
	// Stop transfer
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   181
	SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPdd::stoptransfer TxPdd");
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   182
	
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   183
	//If timer is currently active then cancel it and call back buffer
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   184
	if(iTimer.Cancel())
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   185
		{
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   186
		Callback(iTransferArray[0].iTransferID, KErrNone, iTransferArray[0].iNumBytes);
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   187
		}
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   188
		
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   189
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   190
	}
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   191
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   192
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   193
TInt DDriverSyborgSoundScPdd::PauseTransfer()
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   194
	{
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   195
	SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPdd::pausetransfer TxPdd");
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   196
	//Pause Transfer
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   197
	
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   198
	return KErrNone;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   199
	}
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   200
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   201
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   202
TInt DDriverSyborgSoundScPdd::ResumeTransfer()
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   203
	{
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   204
	SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPdd::resumetransfer TxPdd");
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   205
	//Resume Transfer
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   206
	
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   207
	return KErrNone;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   208
	}
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   209
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   210
TInt DDriverSyborgSoundScPdd::PowerUp()
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   211
	{
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   212
	SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPdd::PowerUp TxPdd");
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   213
	return KErrNone;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   214
	}
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   215
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   216
void DDriverSyborgSoundScPdd::PowerDown()
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   217
	{
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   218
	SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPdd::Powerdown TxPdd");
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   219
	}
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   220
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   221
TInt DDriverSyborgSoundScPdd::CustomConfig(TInt /*aFunction*/,TAny* /*aParam*/)
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   222
	{
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   223
	SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPdd::customconfig TxPdd");
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   224
	return KErrNotSupported;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   225
	}
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   226
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   227
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   228
void DDriverSyborgSoundScPdd::Callback(TUint aTransferID, TInt aTransferResult, TInt aBytesTransferred)
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   229
	{
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   230
	SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPdd::playcallback TxPdd");
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   231
	//Callback when Transfer completes or is stopped
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   232
	
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   233
	iTransferArray.Remove(0);
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   234
	
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   235
	if(iUnitType == KSoundScTxUnit0)
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   236
		{
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   237
		Ldd()->PlayCallback(aTransferID, aTransferResult, aBytesTransferred);
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   238
		}
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   239
	else if(iUnitType == KSoundScRxUnit0)
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   240
		{
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   241
		Ldd()->RecordCallback(aTransferID, aTransferResult, aBytesTransferred);
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   242
		}
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   243
	
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   244
	if(	iTransferArray.Count()>0)
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   245
		{
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   246
		iTimer.OneShot(iTransferArray[0].iPlayTime, ETrue);
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   247
		}
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   248
	
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   249
	}
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   250
18
0b7d3b28f025 DfcQ() requires an argument
John Kern <johnk@symbian.org>
parents: 16
diff changeset
   251
TDfcQue*DDriverSyborgSoundScPdd::DfcQ(TInt /* aUnit*/ )
16
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   252
	{
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   253
	return iPhysicalDevice->iDfcQ;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   254
	}
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   255
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   256
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   257
TInt DDriverSyborgSoundScPdd::MaxTransferLen() const
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   258
	{
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   259
	
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   260
	SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPdd::MaxTransferLen TxPdd");
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   261
	
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   262
	TInt maxlength = 200*1024;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   263
	return maxlength;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   264
	}
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   265
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   266
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   267
void DDriverSyborgSoundScPdd::SetCaps()
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   268
	{
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   269
	SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPdd::SetCaps TxPdd");
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   270
	
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   271
	if(iUnitType == KSoundScTxUnit0)
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   272
		{
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   273
		// The data transfer direction for this unit is play
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   274
		iCaps.iDirection = ESoundDirPlayback;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   275
		}
22
3bf560f85513 fix for bug 877
John Kern <johnk@symbian.org>
parents: 18
diff changeset
   276
	else if(iUnitType == KSoundScRxUnit0)
16
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   277
		{
22
3bf560f85513 fix for bug 877
John Kern <johnk@symbian.org>
parents: 18
diff changeset
   278
		// The data transfer direction for this unit is record 
16
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   279
		iCaps.iDirection = ESoundDirRecord;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   280
		}
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   281
	
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   282
	// This unit supports both mono and stereo
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   283
	iCaps.iChannels = (KSoundMonoChannel | KSoundStereoChannel);
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   284
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   285
	// This unit supports only some of the sample rates offered by Symbian OS
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   286
	iCaps.iRates = (KSoundRate8000Hz | KSoundRate11025Hz | KSoundRate12000Hz | KSoundRate16000Hz |
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   287
					KSoundRate22050Hz | KSoundRate24000Hz | KSoundRate32000Hz | KSoundRate44100Hz |
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   288
					KSoundRate48000Hz);
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   289
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   290
	// This unit only supports 16bit PCM encoding
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   291
	iCaps.iEncodings = KSoundEncoding16BitPCM;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   292
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   293
	// This unit only supports interleaved data format when playing stereo;  that is, a PCM data
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   294
	// stream where the left and right channel samples are interleaved as L-R-L-R-L-R etc.
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   295
	iCaps.iDataFormats = KSoundDataFormatInterleaved;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   296
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   297
	// The iRequestMinSize member is named badly.  It is actually the value of which the length samples
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   298
	// must be a multiple of.  ie.  The sample length % iRequestMinSize must == 0.  This value must always
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   299
	// be a power of 2
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   300
	iCaps.iRequestMinSize = 4;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   301
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   302
	// The logarithm to base 2 of the alignment required for request arguments.  DMA requests must be
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   303
	// aligned to a 32 bit boundary
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   304
	iCaps.iRequestAlignment = 2;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   305
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   306
	// This unit is not capable of detecting changes in hardware configuration
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   307
	iCaps.iHwConfigNotificationSupport = EFalse;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   308
	}
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   309
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   310
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   311
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   312