baseport/syborg/soundsc/shared_txsound.cpp
author bugtracker-ml@nttdocomo.com
Tue, 06 Apr 2010 18:41:44 +0100
changeset 58 11e392ea2e63
parent 45 01c1ffcc4fca
child 72 d00bf4f57250
permissions -rw-r--r--
Bug 1296: E32test t_cputime.exe failed while testing Fast Counter (2nd part of the fix)
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
* 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
     3
* 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
     4
* which accompanies this distribution, and is available
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
     5
* 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
     6
*
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
     7
* Initial Contributors:
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
     8
* Nokia Corporation - initial contribution.
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
     9
*
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    10
* Contributors:
45
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    11
* Accenture Ltd
16
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    12
*
45
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    13
* Description: This file is a part of sound driver for Syborg adaptation.
16
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    14
*
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
#include "shared_sound.h"
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    18
#include "variant_sound.h"
45
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    19
#include "../specific/syborg.h"
16
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    20
45
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    21
#include "virtio.h"
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    22
#include "virtio_audio.h"
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    23
#include "virtio_iohandler.h"
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    24
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    25
using namespace VirtIo;
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    26
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    27
static TInt GetSampleRate( TSoundRate aRate)
16
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    28
	{
45
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    29
	switch(aRate)
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    30
		{
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    31
		case ESoundRate7350Hz: 	return 7350;
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    32
		case ESoundRate8000Hz: 	return 8000;
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    33
		case ESoundRate8820Hz: 	return 8820;
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    34
		case ESoundRate9600Hz: 	return 9600;
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    35
		case ESoundRate11025Hz: return 11025;
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    36
		case ESoundRate12000Hz: return 12000;
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    37
		case ESoundRate14700Hz:	return 14700;
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    38
		case ESoundRate16000Hz: return 16000;
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    39
		case ESoundRate22050Hz: return 22050;
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    40
		case ESoundRate24000Hz: return 24000;
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    41
		case ESoundRate29400Hz: return 29400;
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    42
		case ESoundRate32000Hz: return 32000;
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    43
		case ESoundRate44100Hz: return 44100;
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    44
		case ESoundRate48000Hz: return 48000;
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    45
		}
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    46
	return KErrNotFound;
16
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
45
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    49
static TInt GetSoundEncoding( TSoundEncoding aV )
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    50
	{
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    51
	switch (aV)
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    52
		{
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    53
		case ESoundEncoding8BitPCM: return Audio::EFormatS8;
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    54
		case ESoundEncoding16BitPCM: return Audio::EFormatS16;
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    55
		case ESoundEncoding24BitPCM: break; // not supported
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    56
		}
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    57
	return -KErrNotFound;
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    58
	}
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    59
static TInt GetChannels( TInt aV )
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    60
	{
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    61
	switch (aV)
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    62
		{
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    63
		case KSoundMonoChannel: return 1;
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    64
		case KSoundStereoChannel: return 2;
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    65
		}
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    66
	return KErrNotFound;
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    67
	}
16
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    68
45
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    69
DDriverSyborgSoundScPdd::DDriverSyborgSoundScPdd(DDriverSyborgSoundScPddFactory* aPhysicalDevice, 
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    70
	TInt aUnitType, VirtIo::DIoHandler* aIoHandler, TUint aDataQueueId )
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    71
	: iPhysicalDevice(aPhysicalDevice),  iUnitType(aUnitType), iIoHandler( aIoHandler ), iDataQueueId( aDataQueueId )
16
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
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    75
DDriverSyborgSoundScPdd::~DDriverSyborgSoundScPdd()
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    76
	{
45
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    77
	SYBORG_SOUND_DEBUG("~DDriverSyborgSoundScPdd()");
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    78
	iIoHandler->UnregisterClient( this );
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    79
	delete iAudioControl;
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    80
	SYBORG_SOUND_DEBUG("~DDriverSyborgSoundScPdd() - done");
16
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    81
	}
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    82
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    83
TInt DDriverSyborgSoundScPdd::DoCreate()
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    84
	{
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    85
	SetCaps();
45
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    86
	
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    87
	SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPdd::DoCreate TxPdd");
16
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    88
45
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    89
	SYBORG_SOUND_DEBUG("Registering with IOHandler %x", iIoHandler );
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    90
	iIoHandler->RegisterClient( this );
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    91
	SYBORG_SOUND_DEBUG("Registered with IoHandler... Done %x", iIoHandler);
16
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    92
	
45
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    93
	iAudioControl = new Audio::DControl( *iIoHandler, iDataQueueId );
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    94
	iAudioControl->Construct();
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
    95
		
16
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    96
	return KErrNone;
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
void DDriverSyborgSoundScPdd::GetChunkCreateInfo(TChunkCreateInfo& aChunkCreateInfo)
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
	SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPdd::GetChunkCreateInfo TxPdd");
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   102
	
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   103
	aChunkCreateInfo.iType = TChunkCreateInfo::ESharedKernelMultiple;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   104
	aChunkCreateInfo.iMapAttr = EMapAttrFullyBlocking; 	// No caching
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   105
	aChunkCreateInfo.iOwnsMemory = ETrue; 				// Using RAM pages
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   106
	aChunkCreateInfo.iDestroyedDfc = NULL; 				// No chunk destroy DFC
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
void DDriverSyborgSoundScPdd::Caps(TDes8& aCapsBuf) const
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
	SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPdd::Caps TxPdd");
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   112
	
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   113
	// 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
   114
	aCapsBuf.FillZ(aCapsBuf.MaxLength());
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   115
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   116
	// And copy the capabilities into the packaged structure
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   117
	TPtrC8 ptr((const TUint8*) &iCaps, sizeof(iCaps));
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   118
	aCapsBuf = ptr.Left(Min(ptr.Length(), aCapsBuf.MaxLength()));
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   119
	}
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   120
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   121
TInt DDriverSyborgSoundScPdd::SetConfig(const TDesC8& aConfigBuf)
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   122
	{
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   123
	SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPdd::SetConfig TxPdd");
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   124
	
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   125
	// Read the new configuration from the LDD
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   126
	TCurrentSoundFormatV02 config;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   127
	TPtr8 ptr((TUint8*) &config, sizeof(config));
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   128
	Kern::InfoCopy(ptr, aConfigBuf);
45
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   129
	
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   130
	TInt channels = GetChannels(config.iChannels);
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   131
	Audio::FormatId encoding = static_cast<Audio::FormatId>( GetSoundEncoding(config.iEncoding) );
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   132
	TInt freq = GetSampleRate(config.iRate);
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   133
	Audio::StreamDirection direction = static_cast<Audio::StreamDirection>(
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   134
		(iUnitType == KSoundScRxUnit0)?Audio::EDirectionRecord
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   135
		:(iUnitType == KSoundScTxUnit0)?Audio::EDirectionPlayback:-1 );
16
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   136
45
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   137
	SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPdd::SetConfig c %x, e %x, f %x, d %x",
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   138
		channels, encoding, freq, direction );
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   139
	
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   140
	if ( (channels < 0 )
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   141
		|| ( encoding < 0 )
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   142
		|| ( freq < 0 ) 
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   143
		|| ( direction < 0 )
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   144
		)
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   145
		{
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   146
		SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPdd::SetConfig failed");		
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   147
		return KErrArgument;
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   148
		}
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   149
	
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   150
	TInt st = iAudioControl->Setup( direction, channels, encoding, freq );
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   151
	if (st !=KErrNone)
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   152
		{
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   153
		SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPdd::SetConfig failed %d", st);				
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   154
		return st;
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   155
		}
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   156
	
16
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   157
	iConfig = config;
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
	return KErrNone;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   160
	}
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   161
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
TInt DDriverSyborgSoundScPdd::SetVolume(TInt aVolume)
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   164
	{
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   165
	SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPdd::Setvolume TxPdd");
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   166
	
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   167
	return KErrNone;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   168
	}
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
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   171
TInt DDriverSyborgSoundScPdd::StartTransfer()
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   172
	{
45
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   173
	SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPdd::starttransfer TxPdd S");
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   174
	iAudioControl->SendCommand( Audio::DControl::ERun );
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   175
	return KErrNone;
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   176
	}
16
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
	
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   179
TInt DDriverSyborgSoundScPdd::CalculateBufferTime(TInt aNumBytes)
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   180
	{
45
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   181
	TUint samplerate=GetSampleRate( iConfig.iRate );
16
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
	// integer division by number of channels
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   184
	aNumBytes /= iConfig.iChannels;
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
	// integer division by bytes per sample
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   187
	switch(iConfig.iEncoding)
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
		case ESoundEncoding8BitPCM: break;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   190
		case ESoundEncoding16BitPCM: aNumBytes /= 2; break;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   191
		case ESoundEncoding24BitPCM: aNumBytes /= 3; break;
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
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   194
	return (aNumBytes * 1000) / samplerate; //return time in milliseconds
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   195
	}
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   196
45
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   197
TInt DDriverSyborgSoundScPdd::TransferData(TUint aTransferID, TLinAddr aLinAddr, TPhysAddr aPhysAddr, TInt aNumBytes)
16
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   198
	{
45
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   199
	SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPdd::TransferData unit %x aTId=%x, linAddr=%x,phAddr=%x,len=%x", 
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   200
		iUnitType, aTransferID, aLinAddr, aPhysAddr, aNumBytes);
16
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   201
	
45
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   202
	iAudioControl->SendDataBuffer( 
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   203
		reinterpret_cast<TAny*>( aLinAddr ), aNumBytes, reinterpret_cast<Token>( aTransferID ) );
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   204
16
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   205
	return KErrNone;
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
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   208
void DDriverSyborgSoundScPdd::StopTransfer()
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
	SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPdd::stoptransfer TxPdd");
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   211
	
45
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   212
	iAudioControl->SendCommand( Audio::DControl::EStop );
16
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   213
	}
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
TInt DDriverSyborgSoundScPdd::PauseTransfer()
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::pausetransfer TxPdd");
45
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   219
	iAudioControl->SendCommand( Audio::DControl::EPause );
16
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   220
	return KErrNone;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   221
	}
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
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   224
TInt DDriverSyborgSoundScPdd::ResumeTransfer()
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
	SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPdd::resumetransfer TxPdd");
45
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   227
	iAudioControl->SendCommand( Audio::DControl::EResume );
16
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   228
	return KErrNone;
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
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   231
TInt DDriverSyborgSoundScPdd::PowerUp()
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
	SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPdd::PowerUp TxPdd");
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   234
	return KErrNone;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   235
	}
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
void DDriverSyborgSoundScPdd::PowerDown()
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
	SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPdd::Powerdown TxPdd");
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
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   242
TInt DDriverSyborgSoundScPdd::CustomConfig(TInt /*aFunction*/,TAny* /*aParam*/)
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   243
	{
45
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   244
	SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPdd::CustomConfig TxPdd");
16
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   245
	return KErrNotSupported;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   246
	}
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   247
45
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   248
TBool DDriverSyborgSoundScPdd::VirtIoCallback( MIoHandler& aVirtIoHandler, MQueue& aQueue, 
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   249
	Token aToken, TUint aBytesTransferred )
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   250
	{
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   251
	if ( &aQueue != &iAudioControl->DataQueue() )
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   252
		{ return ETrue; }
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   253
			
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   254
	SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPdd::VirtIoCallback t%x, s%x", aToken, aBytesTransferred);
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   255
	
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   256
	if ( iCaps.iDirection == ESoundDirPlayback )
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   257
		{
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   258
		Ldd()->PlayCallback( (TUint) aToken, KErrNone, aBytesTransferred );
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   259
		}
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   260
	else
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   261
		{
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   262
		Ldd()->RecordCallback( (TUint) aToken, KErrNone, aBytesTransferred );
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   263
		}
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   264
		
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   265
	return EFalse; // cannot process any more buffers in this go due to a bug in LDD?
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   266
	}
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   267
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   268
TDfcQue*DDriverSyborgSoundScPdd::DfcQ()
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   269
	{
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   270
	return iPhysicalDevice->iDfcQ;
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   271
	}
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   272
	
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   273
TDfcQue*DDriverSyborgSoundScPdd::DfcQ( TInt /* aUinit */ )
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   274
	{
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   275
	return iPhysicalDevice->iDfcQ;
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   276
	}
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   277
16
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   278
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   279
TInt DDriverSyborgSoundScPdd::MaxTransferLen() const
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   280
	{
45
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   281
	return KMaxTransferLength; 
16
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   282
	}
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   283
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
void DDriverSyborgSoundScPdd::SetCaps()
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   286
	{
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   287
	SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPdd::SetCaps TxPdd");
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   288
	
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   289
	if(iUnitType == KSoundScTxUnit0)
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   290
		{
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   291
		// 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
   292
		iCaps.iDirection = ESoundDirPlayback;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   293
		}
22
3bf560f85513 fix for bug 877
John Kern <johnk@symbian.org>
parents: 18
diff changeset
   294
	else if(iUnitType == KSoundScRxUnit0)
16
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   295
		{
45
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 23
diff changeset
   296
		// The data transfer direction for this unit is play
16
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   297
		iCaps.iDirection = ESoundDirRecord;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   298
		}
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   299
	
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   300
	// This unit supports both mono and stereo
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   301
	iCaps.iChannels = (KSoundMonoChannel | KSoundStereoChannel);
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   302
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   303
	// 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
   304
	iCaps.iRates = (KSoundRate8000Hz | KSoundRate11025Hz | KSoundRate12000Hz | KSoundRate16000Hz |
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   305
					KSoundRate22050Hz | KSoundRate24000Hz | KSoundRate32000Hz | KSoundRate44100Hz |
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   306
					KSoundRate48000Hz);
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   307
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   308
	// This unit only supports 16bit PCM encoding
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   309
	iCaps.iEncodings = KSoundEncoding16BitPCM;
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
	// 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
   312
	// 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
   313
	iCaps.iDataFormats = KSoundDataFormatInterleaved;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   314
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   315
	// 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
   316
	// 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
   317
	// be a power of 2
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   318
	iCaps.iRequestMinSize = 4;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   319
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   320
	// 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
   321
	// aligned to a 32 bit boundary
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   322
	iCaps.iRequestAlignment = 2;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   323
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   324
	// 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
   325
	iCaps.iHwConfigNotificationSupport = EFalse;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   326
	}
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   327
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   328
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   329
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   330