baseport/syborg/soundsc/variant_sound.cpp
author Maciej Jablonski <maciej.jablonski@accenture.com>
Thu, 04 Mar 2010 00:55:21 +0000
changeset 45 01c1ffcc4fca
parent 16 73107a0bc259
permissions -rw-r--r--
Audio driver for qemu simulator
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: 16
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: 16
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 "variant_sound.h"
45
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
    18
#include "virtio_iohandler.h"
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
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
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    21
_LIT(KSoundScPddName, "SoundSc.Syborg");
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
DECLARE_STANDARD_PDD()
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    24
	{
45
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
    25
	SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPddFactory created\n");
16
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    26
	return new DDriverSyborgSoundScPddFactory;
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
DDriverSyborgSoundScPddFactory::DDriverSyborgSoundScPddFactory()
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
	iUnitsMask = ((1 << KSoundScTxUnit0) | (1 << KSoundScRxUnit0));
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
	iVersion = RSoundSc::VersionRequired();
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    35
	}
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
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    38
TInt DDriverSyborgSoundScPddFactory::Install()
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
	_LIT(KAudioDFC, "AUDIO DFC");
45
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
    41
	
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
    42
	// LDD driver is going to use the same queue.
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
    43
	TInt r = Kern::DynamicDfcQCreate(iDfcQ, KAudioDfcQueuePriority, KAudioDFC);
16
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    44
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    45
	SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPddFactory::PDD install");
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    46
45
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
    47
	if(r!=KErrNone)
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
    48
		{
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
    49
		SYBORG_SOUND_DEBUG("Creating audio DFC failed %d",r);
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
    50
		return r;
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
    51
		}
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
    52
	// All PDD factories must have a unique name
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
    53
	r = SetName(&KSoundScPddName);
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
    54
	if (r!=KErrNone)
16
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    55
		{
45
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
    56
		SYBORG_SOUND_DEBUG("Setting name %x",r);
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
    57
		return r;
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
    58
		}
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
    59
	iIoHandler = new VirtIo::DIoHandler(	
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
    60
		(TAny*)KHwSVPAudioDevice, 
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
    61
		EIntAudio0,
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
    62
		iDfcQ );
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
    63
	
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
    64
	if (iIoHandler == NULL)
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
    65
		{
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
    66
		iDfcQ->Destroy();
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
    67
		return KErrNoMemory;
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: 16
diff changeset
    69
	
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
    70
	SYBORG_SOUND_DEBUG("Constructing IoHandler");
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
    71
	
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
    72
	r = iIoHandler->Construct();
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
    73
	
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
    74
	if ( r != KErrNone)
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
    75
		{
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
    76
		iDfcQ->Destroy();		
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
    77
		delete iIoHandler;
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
    78
		}
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
    79
		
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
    80
	SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPddFactory::PDD installed");
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
    81
	
16
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    82
	return r;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
    83
	}
45
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
    84
	
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
    85
DDriverSyborgSoundScPddFactory::~DDriverSyborgSoundScPddFactory()
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
    86
	{
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
    87
	if (iIoHandler)
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
    88
		{
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
    89
		delete iIoHandler;
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
    90
		iIoHandler = NULL;
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
    91
		}
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
    92
	if (iDfcQ)
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
    93
		iDfcQ->Destroy();
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
    94
	}
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
    95
	
16
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
void DDriverSyborgSoundScPddFactory::GetCaps(TDes8& /*aDes*/) const
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
	}
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
TInt DDriverSyborgSoundScPddFactory::Validate(TInt aUnit, const TDesC8* /*aInfo*/, const TVersion& aVer)
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
	// Check that the version requested is less than or equal to the version of this PDD
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   105
	if (!Kern::QueryVersionSupported(RSoundSc::VersionRequired(), aVer))
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
		SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPddFactory::Validate KErrNotSup1");
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   108
		return KErrNotSupported;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   109
		}
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
	// Check the unit number specifies either playback or recording
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   112
	if ((aUnit != KSoundScTxUnit0) && (aUnit != KSoundScRxUnit0))
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
		SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPddFactory::Validate KErrNotSup2");
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   115
		return KErrNotSupported;
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
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   118
	SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPddFactory::Validate KErrNone");
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   119
	return KErrNone;
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
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   122
TInt DDriverSyborgSoundScPddFactory::Create(DBase*& aChannel, TInt aUnit, const TDesC8* /*aInfo*/, const TVersion& /*aVer*/)
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   123
	{
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
	SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPddFactory::PDD create aUnit %d TxUnitId %d", aUnit, KSoundScTxUnit0);
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   126
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   127
	// Assume failure
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   128
	TInt r = KErrNoMemory;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   129
	aChannel = NULL;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   130
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   131
				
45
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
   132
	DDriverSyborgSoundScPdd* pTxD = new DDriverSyborgSoundScPdd( this, aUnit, 
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
   133
		iIoHandler, aUnit == KSoundScTxUnit0?1:2 );
16
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   134
45
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
   135
	SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPddFactory::TxPdd %x", pTxD);
16
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
	if (pTxD)
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   138
		{
45
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
   139
		SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPddFactory::TxPdd2 %x", pTxD);
16
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   140
			
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   141
		r = pTxD->DoCreate();
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
		SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPddFactory::Create ret %d", r);
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   144
			
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   145
		}
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
	// If everything succeeded, save a pointer to the PDD.  This should only be done if DoCreate() succeeded,
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   148
	// as some LDDs have been known to access this pointer even if Create() returns an error!
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   149
	if (r == KErrNone)
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   150
		{
45
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
   151
		aChannel = pTxD;
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
   152
		SYBORG_SOUND_DEBUG("DDriverSyborgSoundScPddFactory::TxPdd set AChannel %x", aChannel);
16
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   153
		}
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   154
	else
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   155
		{
45
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
   156
		delete pTxD;
16
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   157
		}
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 r;
73107a0bc259 Merged patch from Johnathan White (@accenture)
Martin Trojer <martin.trojer@nokia.com>
parents:
diff changeset
   160
	}
45
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
   161
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
   162
	
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
   163
VirtIo::MIoHandler* DDriverSyborgSoundScPddFactory::IoHandler()
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
   164
	{
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
   165
	return iIoHandler;
01c1ffcc4fca Audio driver for qemu simulator
Maciej Jablonski <maciej.jablonski@accenture.com>
parents: 16
diff changeset
   166
	}