`Page 1/15
`Saved: 10/22/01, 6:28:14 PM
`Printed for: Implicit
`
`/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`1
`+++++¬
`…
`¬2
`Copyright (c) 2001 BeComm Corporation¬
`3
`¬4
`Filename:¬
`5
`¬6
` speaker.c¬
`7
`¬8
`Abstract:¬
`9
`¬10
` Bead to send audio to an output device.¬
`11
`¬12
` TODO - need to add¬
`13
`- RTP (or other) format decryption¬
`14
`- pause/stop/resume control edge¬
`15
`- queue management (?)¬
`16
`- device configuration¬
`17
`¬
`18
`Owner:¬
`19
`¬20
` Guy Carpenter (guyc)¬
`21
`¬22
`--------------------------------------------------------------------------
`23
`---*/¬
`…
`¬24
`#define SOS_DEBUG_ZONE "/beads/speaker"¬
`25
`¬26
`#include <sosstrings.h>¬
`27
`#include <sosmultimedia.h>¬
`28
`¬29
`SOS_SOURCE_VERSION (¬
`30
` "$Id: speaker.c,v 1.25 2001/10/22 23:28:14 guyc Exp $"¬
`31
`);¬
`32
`¬33
`#define SPEAKER_BEAD_NAME "Speaker"¬
`34
`/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`35
`+++++¬
`…
`Configuration¬
`36
`++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`37
`+++*/¬
`…
`¬38
`// REVISIT - device name should not be hard coded.¬
`39
`#define DEVICE_CLASS "audioout"¬
`40
`#define DEVICE_NAME "default"¬
`41
`
`Page 1 of 15
`
`Implicit Exhibit 2051
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.01/bea…/…/main/speaker.c
`Page 2/15
`Saved: 10/22/01, 6:28:14 PM
`Printed for: Implicit
`
`¬42
`¬43
`/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`44
`+++++¬
`…
`Types¬
`45
`++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`46
`+++*/¬
`…
`typedef struct _SPEAKER_CONTEXT {¬
`47
` SOS_REGOBJECT * AudioOutDevice;¬
`48
` SOS_IAUDIOOUT * IAudioOut;¬
`49
` SOS_AUDIO_FORMAT Format;¬
`50
` SOS_IAUDIOCONTEXT * IAudioContext;¬
`51
` char * DeviceName;¬
`52
` SOS_BOOLEAN FormatIsSet;¬
`53
` SOS_ISAMPLECLOCK * ISampleClock;¬
`54
`} SPEAKER_CONTEXT;¬
`55
`¬56
`¬57
`/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`58
`+++++¬
`…
`Context¬
`59
`++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`60
`+++*/¬
`…
`SOS_STATUS¬
`61
`Speaker_ContextCreate(¬
`62
` SPEAKER_CONTEXT ** Context¬
`63
`)¬
`64
`{¬
`65
` SOS_STATUS status = SOS_Success;¬
`66
` SPEAKER_CONTEXT *context = SOS_Mem_Alloc(sizeof(*context));¬
`67
` if (context) {¬
`68
` SOS_memset(context, 0, sizeof(*context));¬
`69
` // REVISIT - this should come from the path context¬
`70
` context->DeviceName = SOS_strdup(DEVICE_NAME);¬
`71
` } else {¬
`72
` status = SOS_ErrorResourceAllocation;¬
`73
` }¬
`74
` *Context = context;¬
`75
` return status;¬
`76
`}¬
`77
`¬78
`SOS_STATUS¬
`79
`Speaker_ContextDestroy(¬
`80
` SPEAKER_CONTEXT * Context¬
`81
`)¬
`82
`
`Page 2 of 15
`
`Implicit Exhibit 2051
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.01/bea…/…/main/speaker.c
`Page 3/15
`Saved: 10/22/01, 6:28:14 PM
`Printed for: Implicit
`
`{¬
`83
` SOS_STATUS status = SOS_Success;¬
`84
`¬85
` if (Context) {¬
`86
` if (Context->AudioOutDevice) {¬
`87
` SOS_RegObject_Release(Context->AudioOutDevice);¬
`88
` }¬
`89
` if (Context->IAudioContext) {¬
`90
` SOS_Interface_Release(Context->IAudioContext);¬
`91
` }¬
`92
`¬93
` if (Context->ISampleClock) {¬
`94
` SOS_Interface_Release(Context->ISampleClock);¬
`95
` }¬
`96
` ¬
`97
` if (Context->DeviceName) {¬
`98
` SOS_Mem_Free(Context->DeviceName);¬
`99
` }¬
`100
`¬
`101
` SOS_Mem_Free(Context);¬
`102
` }¬
`103
` return status;¬
`104
`}¬
`105
`¬
`106
`/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`107
`+++++¬
`…
`Local Functions¬
`108
`++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`109
`+++*/¬
`…
`SOS_STATUS¬
`110
`Speaker_DeviceOpen(¬
`111
` SPEAKER_CONTEXT * Context¬
`112
`)¬
`113
`{¬
`114
` SOS_STATUS status;¬
`115
`¬
`116
`/*¬
`117
` * NOTE : if we return an error, make sure the device is not¬
`118
` * still opened or referenced.¬
`119
` */¬
`120
` status = SOS_Registry_DeviceGet(¬
`121
` DEVICE_CLASS,¬
`122
` Context->DeviceName,¬
`123
` &Context->AudioOutDevice);¬
`124
`¬
`125
`
`Page 3 of 15
`
`Implicit Exhibit 2051
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.01/bea…/…/main/speaker.c
`Page 4/15
`Saved: 10/22/01, 6:28:14 PM
`Printed for: Implicit
`
`126
`127
`128
`129
`130
`131
`132
`133
`134
`135
`136
`137
`138
`139
`140
`141
`142
`143
`144
`145
`146
`147
`148
`149
`150
`151
`152
`153
`154
`155
`156
`157
`158
`159
`160
`161
`162
`163
`164
`165
`166
`167
`168
`169
`170
`
` if (SOS_SUCCEEDED(status)) {¬
` status = SOS_RegObject_InterfaceGet(¬
` Context->AudioOutDevice,¬
` SOS_IAUDIOOUT_ID,¬
` (void**)&Context->IAudioOut¬
` );¬
` }¬
`¬
` if (SOS_SUCCEEDED(status)) {¬
` status = Context->IAudioOut->Open(¬
` Context->IAudioOut,¬
` &Context->Format);¬
` }¬
`¬
` if (SOS_FAILED(status)) {¬
` SOS_RegObject_Release(Context->AudioOutDevice);¬
` SOS_Interface_Release(Context->IAudioOut);¬
` Context->AudioOutDevice = NULL;¬
` Context->IAudioOut = NULL;¬
` }¬
`¬
` return status;¬
`}¬
`¬
`¬
`SOS_STATUS¬
`Speaker_DeviceClose(¬
` SPEAKER_CONTEXT * Context¬
`)¬
`{¬
` SOS_STATUS status = SOS_Success;¬
`¬
` if (Context->IAudioOut) {¬
` status = Context->IAudioOut->Close(¬
` Context->IAudioOut¬
` );¬
` SOS_RegObject_InterfaceRelease(Context->IAudioOut);¬
` Context->IAudioOut = NULL;¬
` }¬
`¬
` SOS_RegObject_Release(Context->AudioOutDevice);¬
` Context->AudioOutDevice = NULL;¬
`¬
` return status;¬
`} ¬
`
`Page 4 of 15
`
`Implicit Exhibit 2051
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.01/bea…/…/main/speaker.c
`Page 5/15
`Saved: 10/22/01, 6:28:14 PM
`Printed for: Implicit
`
`171
`172
`173
`174
`175
`176
`177
`178
`179
`180
`181
`182
`183
`184
`185
`186
`187
`188
`189
`190
`191
`192
`193
`194
`195
`196
`197
`198
`199
`200
`201
`…
`202
`203
`204
`205
`206
`207
`208
`209
`210
`211
`212
`213
`214
`
`¬
`¬
`SOS_STATUS¬
`Speaker_DeviceWrite(¬
` SPEAKER_CONTEXT * Context,¬
` SOS_MESSAGE * Message¬
`)¬
`{¬
` SOS_STATUS status;¬
` int byteCount = SOS_Message_LengthGet(Message);¬
` char *buffer = SOS_Mem_Alloc(byteCount);¬
`¬
` if (buffer) {¬
` SOS_Message_DataRemove(¬
` Message,¬
` 0,¬
` byteCount,¬
` buffer,¬
` NULL);¬
`¬
`#if 0¬
` {¬
` SOS_UINT32 queuedSamples;¬
` Context->IAudioOut->QueuedSamplesGet(¬
` Context->IAudioOut,¬
` &queuedSamples¬
` );¬
` SOS_Debug_StringPrint(¬
` "%d queued samples in speaker before writing %d\n",¬
` queuedSamples,¬
`
`byteCount/Context->Format.Channels/(Context->Format.SampleBits/8)¬
` );¬
` }¬
`#endif¬
` ¬
` status = Context->IAudioOut->Write(¬
` Context->IAudioOut,¬
` 0, /* no delay */¬
` buffer,¬
` byteCount¬
` );¬
`¬
` SOS_Mem_Free(buffer);¬
`¬
`
`Page 5 of 15
`
`Implicit Exhibit 2051
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.01/bea…/…/main/speaker.c
`Page 6/15
`Saved: 10/22/01, 6:28:14 PM
`Printed for: Implicit
`
`215
`216
`217
`218
`219
`220
`221
`222
`223
`224
`225
`226
`227
`228
`229
`230
`231
`232
`233
`234
`235
`236
`237
`238
`…
`239
`240
`…
`241
`242
`243
`244
`245
`246
`247
`248
`249
`250
`251
`252
`253
`254
`255
`256
`257
`
`#if 0¬
` {¬
` SOS_UINT32 queuedSamples;¬
` Context->IAudioOut->QueuedSamplesGet(¬
` Context->IAudioOut,¬
` &queuedSamples¬
` );¬
` SOS_Debug_StringPrint(¬
` "%d queued samples in speaker after write\n",¬
` queuedSamples¬
` );¬
` }¬
`#endif¬
` ¬
` } else {¬
` status = SOS_ErrorResourceAllocation;¬
` }¬
`¬
` SOS_Message_Destroy(Message);¬
` return status;¬
`}¬
`¬
`¬
`/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`+++++¬
`¬
`++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`+++*/¬
`¬
`static¬
`SOS_STATUS¬
`Speaker_SampleClockGet(¬
` SPEAKER_CONTEXT * Context,¬
` SOS_PATH * Path¬
`)¬
`{¬
` SOS_STATUS status;¬
` SOS_REGOBJECT *clockObject;¬
` SOS_ISAMPLECLOCK *iSampleClock;¬
`¬
` status = SOS_Path_AttributeGet(¬
` Path,¬
` SOS_RENDERCLOCK_NAME,¬
` &clockObject¬
` );¬
`
`Page 6 of 15
`
`Implicit Exhibit 2051
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.01/bea…/…/main/speaker.c
`Page 7/15
`Saved: 10/22/01, 6:28:14 PM
`Printed for: Implicit
`
`258
`259
`260
`261
`262
`263
`264
`265
`266
`267
`268
`269
`270
`271
`272
`273
`274
`275
`276
`277
`278
`279
`280
`281
`282
`283
`284
`285
`286
`287
`288
`289
`290
`291
`292
`293
`294
`295
`296
`297
`298
`299
`300
`301
`302
`
`¬
` if (SOS_SUCCEEDED(status)) {¬
` status = SOS_RegObject_InterfaceGet(¬
` clockObject,¬
` SOS_ISAMPLECLOCK_ID,¬
` (void**)&iSampleClock¬
` );¬
`¬
` if (SOS_SUCCEEDED(status)) {¬
` Context->ISampleClock = iSampleClock;¬
` }¬
` SOS_RegObject_Release(clockObject);¬
` }¬
`¬
` return status;¬
`}¬
`¬
`¬
` ¬
`static¬
`SOS_STATUS¬
`Speaker_AudioContextGet(¬
` SPEAKER_CONTEXT * Context,¬
` SOS_PATH * Path¬
`)¬
`{¬
` SOS_STATUS status;¬
` SOS_REGOBJECT *contextObject;¬
` SOS_IAUDIOCONTEXT *iAudioContext;¬
`¬
` status = SOS_Path_AttributeGet(¬
` Path,¬
` SOS_AUDIOCONTEXT_NAME,¬
` &contextObject¬
` );¬
`¬
` SOS_ASSERT_SOFT_ERROR(¬
` SOS_SUCCEEDED(status),¬
` "Path context does not contain an audio context"¬
` );¬
`¬
` if (SOS_SUCCEEDED(status)) {¬
` status = SOS_RegObject_InterfaceGet(¬
` contextObject,¬
` SOS_IAUDIOCONTEXT_ID,¬
`
`Page 7 of 15
`
`Implicit Exhibit 2051
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.01/bea…/…/main/speaker.c
`Page 8/15
`Saved: 10/22/01, 6:28:14 PM
`Printed for: Implicit
`
`303
`304
`305
`306
`307
`308
`309
`310
`311
`312
`313
`314
`315
`316
`317
`318
`319
`…
`320
`321
`…
`322
`323
`324
`325
`326
`327
`328
`329
`330
`331
`332
`333
`334
`335
`336
`337
`338
`339
`340
`341
`342
`343
`344
`345
`
` (void**)&iAudioContext¬
` );¬
`¬
` SOS_ASSERT_SOFT_ERROR(¬
` SOS_SUCCEEDED(status),¬
` "Audio context does not support required interface"¬
` );¬
`¬
` if (SOS_SUCCEEDED(status)) {¬
` Context->IAudioContext = iAudioContext;¬
` }¬
` SOS_RegObject_Release(contextObject);¬
` }¬
` return status;¬
`}¬
` ¬
`/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`+++++¬
`Handlers¬
`++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`+++*/¬
`¬
`static¬
`SOS_STATUS¬
`Speaker_KeyCreate(¬
` SOS_PATH *Path,¬
` SOS_MESSAGE *Message¬
`)¬
`{¬
` static int s_UniqueId = 0;¬
` SOS_REGOBJECT *key = SOS_UInt32_Create(++s_UniqueId);¬
`¬
` SOS_DEBUGOUT_FUNC_TRACE("Speaker_KeyCreate called\n");¬
`¬
` SOS_Path_SessionKeySet(Path, key);¬
`¬
` SOS_RegObject_Release(key);¬
` return SOS_PathBuild_Stop;¬
`}¬
`¬
`¬
`static¬
`SOS_STATUS¬
`Speaker_EncodeMessageHandler(¬
` SOS_PATH *Path,¬
`
`Page 8 of 15
`
`Implicit Exhibit 2051
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.01/bea…/…/main/speaker.c
`Page 9/15
`Saved: 10/22/01, 6:28:14 PM
`Printed for: Implicit
`
`346
`347
`348
`349
`350
`351
`352
`353
`354
`355
`356
`357
`358
`359
`360
`361
`362
`363
`364
`365
`366
`367
`368
`369
`370
`371
`372
`373
`374
`375
`376
`377
`378
`379
`380
`381
`382
`383
`384
`385
`386
`387
`388
`389
`390
`
` SOS_MESSAGE *Message¬
`)¬
`{¬
` SOS_STATUS status = SOS_Success;¬
` SPEAKER_CONTEXT *context;¬
` SOS_DEBUGOUT_FUNC_TRACE("Speaker_EncodeMessageHandler called\n");¬
` SOS_Path_SessionContextPeek(Path, (void**)&context);¬
`¬
` /*¬
` * The first thing we need is the audio context. The¬
` * first time the handler gets called we should get it.¬
` */¬
`¬
` if (!context->IAudioContext) {¬
` status = Speaker_AudioContextGet(¬
` context,¬
` Path);¬
` SOS_ASSERT_HARD_ERROR(¬
` SOS_SUCCEEDED(status),¬
` "Audio context not found"¬
` );¬
` }¬
`¬
` if (!context->ISampleClock) {¬
` status = Speaker_SampleClockGet(¬
` context,¬
` Path);¬
` }¬
`¬
` if (context->IAudioContext) {¬
` SOS_AUDIO_FORMAT format;¬
` /*¬
` * If we have a context, we can unpack (which will¬
` * ensure the format is available on subsequent calls¬
` * to the context).¬
` */¬
`¬
` status = context->IAudioContext->Unpack(¬
` context->IAudioContext,¬
` Message¬
` );¬
`¬
` status = context->IAudioContext->FormatGet(¬
` context->IAudioContext,¬
` NULL, /* no message, we've already unpacked it */¬
`
`Page 9 of 15
`
`Implicit Exhibit 2051
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.01/bea…/…/main/speaker.c
`Page 10/15
`Saved: 10/22/01, 6:28:14 PM
`Printed for: Implicit
`
`391
`392
`393
`394
`395
`396
`397
`398
`399
`400
`401
`402
`403
`404
`405
`406
`407
`408
`409
`410
`411
`412
`413
`414
`415
`416
`417
`418
`419
`420
`421
`422
`423
`424
`425
`426
`427
`428
`429
`430
`431
`432
`433
`434
`435
`
` &format¬
` );¬
`¬
` if (context->IAudioOut && ¬
` !(context->Format.Frequency ==format.Frequency &&¬
` context->Format.Channels ==format.Channels &&¬
` context->Format.SampleBits==format.SampleBits)) {¬
` /*¬
` * Format has changed. Close for immediate reopening.¬
` */¬
` context->IAudioOut->Close(context->IAudioOut);¬
` SOS_Interface_Release(context->IAudioOut);¬
` context->IAudioOut=NULL;¬
` }¬
`¬
` if (!context->IAudioOut) {¬
` /*¬
` * If we don't have an output interface,¬
` * we should try opening the device.¬
` */¬
` context->Format = format;¬
`¬
` SOS_ASSERT_HARD_ERROR(¬
` SOS_SUCCEEDED(status),¬
` "Could not get format from audio context"¬
` );¬
` ¬
` if (SOS_SUCCEEDED(status)) {¬
`¬
` SOS_DEBUGOUT_MAJOR_EVENT(¬
` "Speaker format is %u/%u/%u\n",¬
` context->Format.Frequency,¬
` context->Format.SampleBits,¬
` context->Format.Channels¬
` );¬
`¬
` status = Speaker_DeviceOpen(context);¬
` SOS_ASSERT_HARD_ERROR(¬
` SOS_SUCCEEDED(status),¬
` "Could not open audio device"¬
` );¬
`¬
` if (context->IAudioContext && context->ISampleClock) {¬
` context->ISampleClock->FrequencySet(¬
` context->ISampleClock,¬
`
`Page 10 of 15
`
`Implicit Exhibit 2051
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.01/bea…/…/main/speaker.c
`Page 11/15
`Saved: 10/22/01, 6:28:14 PM
`Printed for: Implicit
`
`436
`437
`438
`439
`440
`441
`442
`443
`444
`445
`446
`447
`448
`449
`450
`451
`452
`453
`454
`455
`456
`457
`458
`459
`460
`461
`462
`463
`464
`465
`466
`467
`468
`469
`470
`471
`472
`473
`474
`475
`476
`477
`478
`479
`480
`
` context->Format.Frequency,¬
` SOS_MSPERSECOND¬
` );¬
` } ¬
`¬
` }¬
` ¬
` }¬
` }¬
`¬
` if (context->IAudioOut) { ¬
` /*¬
` * If we have an audio context AND a sample clock¬
` * then we must update the sample clock, and don't¬
` * forget to subtract the queued samples so we ¬
` * indicate the actual playout position.¬
` *¬
` * Note that we do this before we write, because we¬
` * have the time stamp for the beginning of the audio,¬
` * not the end of the audio.¬
` */¬
` if (context->ISampleClock) {¬
` SOS_UINT32 samplesPlayed, samplesQueued;¬
` ¬
` if (context->IAudioContext) {¬
` context->IAudioContext->TimeStampGet(¬
` context->IAudioContext,¬
` NULL, /* message is already decoded */¬
` &samplesPlayed¬
` );¬
`¬
` context->IAudioOut->QueuedSamplesGet(¬
` context->IAudioOut,¬
` &samplesQueued¬
` );¬
`¬
` SOS_DEBUGOUT_DETAIL(¬
` "clock %p updated to %d (played %d, queued %d)\n",¬
` SOS_Interface_ObjectPeek(context->ISampleClock),¬
` samplesPlayed-samplesQueued,¬
` samplesPlayed,¬
` samplesQueued¬
` );¬
` /*¬
` * REVISIT - this will be problematical when samplesPlayed¬
`
`Page 11 of 15
`
`Implicit Exhibit 2051
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.01/bea…/…/main/speaker.c
`Page 12/15
`Saved: 10/22/01, 6:28:14 PM
`Printed for: Implicit
`
`481
`482
`483
`484
`485
`486
`487
`488
`489
`490
`491
`492
`493
`494
`495
`496
`497
`498
`499
`500
`501
`502
`503
`504
`505
`506
`507
`508
`509
`510
`511
`512
`513
`514
`515
`516
`517
`518
`519
`520
`521
`522
`523
`524
`525
`
` * rolls over at 2^32. ¬
` */¬
` {¬
` SOS_CLOCK_TICK now = SOS_Clock_TickGet();¬
` SOS_UINT32 sample;¬
`¬
` if (samplesQueued > samplesPlayed) {¬
` /*¬
` * This can happen when someone¬
` * is messing with the sample clock to¬
` * maintain synchronization. Essentially¬
` * we are looking at a negative sample number,¬
` * but we cannot tell the sample clock that or¬
` * it will interpret it as a large positive value.¬
` */¬
` sample = 0;¬
` now += (samplesQueued - samplesPlayed) *¬
` SOS_MSPERSECOND / context->Format.Frequency;¬
` } else {¬
` sample = samplesPlayed-samplesQueued;¬
` }¬
`¬
` context->ISampleClock->Update(¬
` context->ISampleClock,¬
` now,¬
` sample¬
` );¬
` }¬
` }¬
` }¬
` ¬
` /*¬
` * If we've managed to get a device, write to it.¬
` */¬
` status = Speaker_DeviceWrite(context, Message);¬
` SOS_ASSERT_HARD_ERROR(¬
` SOS_SUCCEEDED(status),¬
` "Could not write to audio device"¬
` );¬
`¬
` } else {¬
` SOS_Message_Destroy(Message);¬
` }¬
` ¬
` return status;¬
`
`Page 12 of 15
`
`Implicit Exhibit 2051
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.01/bea…/…/main/speaker.c
`Page 13/15
`Saved: 10/22/01, 6:28:14 PM
`Printed for: Implicit
`
`526
`527
`528
`529
`530
`531
`532
`533
`534
`535
`536
`537
`538
`539
`540
`541
`542
`543
`544
`545
`546
`547
`548
`549
`550
`551
`552
`553
`554
`555
`556
`557
`558
`559
`560
`561
`562
`563
`564
`565
`566
`567
`568
`569
`570
`
`}¬
`¬
`static¬
`SOS_STATUS¬
`Speaker_SessionInitialize(¬
` SOS_PATH *Path¬
`)¬
`{¬
` SOS_STATUS status = SOS_Success;¬
`¬
` SPEAKER_CONTEXT *context;¬
`¬
` SOS_DEBUGOUT_FUNC_TRACE("Speaker_SessionInit called\n");¬
`¬
` status = Speaker_ContextCreate(&context);¬
`¬
` if (SOS_SUCCEEDED(status)) {¬
` status = SOS_Path_SessionContextPut(Path, context);¬
` }¬
`¬
` if (SOS_FAILED(status)) {¬
` Speaker_ContextDestroy(context);¬
` }¬
`¬
` return status;¬
`}¬
`¬
`static¬
`SOS_STATUS¬
`Speaker_SessionUninitialize(¬
` SOS_PATH *Path¬
`)¬
`{¬
` SOS_STATUS status = SOS_Success;¬
` SPEAKER_CONTEXT *context;¬
`¬
` SOS_DEBUGOUT_FUNC_TRACE("Speaker_SessionUninit called\n");¬
`¬
` SOS_Path_SessionContextPeek(Path, (void**)&context);¬
`¬
` Speaker_DeviceClose(context);¬
` Speaker_ContextDestroy(context);¬
` ¬
` return status;¬
`}¬
`
`Page 13 of 15
`
`Implicit Exhibit 2051
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.01/bea…/…/main/speaker.c
`Page 14/15
`Saved: 10/22/01, 6:28:14 PM
`Printed for: Implicit
`
`571
`572
`573
`574
`575
`576
`577
`578
`579
`580
`581
`582
`583
`584
`585
`586
`587
`588
`589
`590
`591
`592
`593
`594
`595
`596
`597
`598
`599
`600
`601
`602
`603
`604
`605
`606
`607
`608
`609
`…
`610
`611
`…
`612
`613
`
`¬
`static¬
`SOS_STATUS¬
`Speaker_BeadInitialize(¬
` SOS_BEAD *Bead,¬
` SOS_REGOBJECT *InitContext¬
`)¬
`{¬
` SOS_STATUS status = SOS_Success;¬
`¬
` /* register Encode Edge */¬
` status = SOS_Edge_Register(¬
` Bead,¬
` "Encode",¬
` NULL,¬
` NULL,¬
` NULL,¬
` Speaker_KeyCreate,¬
` Speaker_EncodeMessageHandler,¬
` NULL,¬
` NULL,¬
` NULL,¬
` NULL);¬
`¬
` return status;¬
`}¬
`¬
`static¬
`SOS_STATUS¬
`Speaker_BeadUninitialize(¬
` void *BeadContext¬
`)¬
`{¬
` SOS_STATUS status = SOS_Success;¬
`¬
` return status;¬
`}¬
`¬
`/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`+++++¬
`Initialization Routines¬
`++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
`+++*/¬
`SOS_STATUS¬
`SOS_ModuleInit (¬
`
`Page 14 of 15
`
`Implicit Exhibit 2051
`Sonos v. Implicit, IPR2018-0766, -0767
`
`
`
`/Users/implicit/Desktop/Source Code/2001.11.01/bea…/…/main/speaker.c
`Page 15/15
`Saved: 10/22/01, 6:28:14 PM
`Printed for: Implicit
`
` SOS_OBJECTFILE *ObjectFile,¬
` SOS_REGOBJECT *InitContext¬
`)¬
`{¬
` SOS_STATUS status;¬
` ¬
` /* register Bead */¬
`¬
` status = SOS_Bead_Register(¬
` ObjectFile,¬
` SPEAKER_BEAD_NAME,¬
` NULL, /* bead init context */¬
` Speaker_BeadInitialize,¬
` Speaker_BeadUninitialize,¬
` Speaker_SessionInitialize,¬
` Speaker_SessionUninitialize);¬
`¬
` return SOS_Success;¬
`}¬
`¬
`void¬
`SOS_ModuleUninit (¬
` SOS_OBJECTFILE *ObjectFile¬
`)¬
`{¬
` /* cleanup test bead */¬
`}¬
`
`614
`615
`616
`617
`618
`619
`620
`621
`622
`623
`624
`625
`626
`627
`628
`629
`630
`631
`632
`633
`634
`635
`636
`637
`638
`639
`640
`641
`
`Page 15 of 15
`
`Implicit Exhibit 2051
`Sonos v. Implicit, IPR2018-0766, -0767
`
`