source: svn/newcon3bcm2_21bu/nexus/modules/audio/7552/src/nexus_audio_playback.c

Last change on this file was 76, checked in by megakiss, 10 years ago

1W 대기전력을 만족시키기 위하여 POWEROFF시 튜너를 Standby 상태로 함

  • Property svn:executable set to *
File size: 25.7 KB
Line 
1/***************************************************************************
2*     (c)2004-2011 Broadcom Corporation
3
4*  This program is the proprietary software of Broadcom Corporation and/or its licensors,
5*  and may only be used, duplicated, modified or distributed pursuant to the terms and
6*  conditions of a separate, written license agreement executed between you and Broadcom
7*  (an "Authorized License").  Except as set forth in an Authorized License, Broadcom grants
8*  no license (express or implied), right to use, or waiver of any kind with respect to the
9*  Software, and Broadcom expressly reserves all rights in and to the Software and all
10*  intellectual property rights therein.  IF YOU HAVE NO AUTHORIZED LICENSE, THEN YOU
11*  HAVE NO RIGHT TO USE THIS SOFTWARE IN ANY WAY, AND SHOULD IMMEDIATELY
12*  NOTIFY BROADCOM AND DISCONTINUE ALL USE OF THE SOFTWARE. 
13*   
14*  Except as expressly set forth in the Authorized License,
15*   
16*  1.     This program, including its structure, sequence and organization, constitutes the valuable trade
17*  secrets of Broadcom, and you shall use all reasonable efforts to protect the confidentiality thereof,
18*  and to use this information only in connection with your use of Broadcom integrated circuit products.
19*   
20*  2.     TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
21*  AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES, REPRESENTATIONS OR
22*  WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
23*  THE SOFTWARE.  BROADCOM SPECIFICALLY DISCLAIMS ANY AND ALL IMPLIED WARRANTIES
24*  OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE,
25*  LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION
26*  OR CORRESPONDENCE TO DESCRIPTION. YOU ASSUME THE ENTIRE RISK ARISING OUT OF
27*  USE OR PERFORMANCE OF THE SOFTWARE.
28
29*  3.     TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL BROADCOM OR ITS
30*  LICENSORS BE LIABLE FOR (i) CONSEQUENTIAL, INCIDENTAL, SPECIAL, INDIRECT, OR
31*  EXEMPLARY DAMAGES WHATSOEVER ARISING OUT OF OR IN ANY WAY RELATING TO YOUR
32*  USE OF OR INABILITY TO USE THE SOFTWARE EVEN IF BROADCOM HAS BEEN ADVISED OF
33*  THE POSSIBILITY OF SUCH DAMAGES; OR (ii) ANY AMOUNT IN EXCESS OF THE AMOUNT
34*  ACTUALLY PAID FOR THE SOFTWARE ITSELF OR U.S. $1, WHICHEVER IS GREATER. THESE
35*  LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF
36*  ANY LIMITED REMEDY.
37*
38* $brcm_Workfile: nexus_audio_playback.c $
39* $brcm_Revision: 5 $
40* $brcm_Date: 8/15/11 1:59p $
41*
42* API Description:
43*   API name: AudioPlayback
44*    Specific APIs related to PCM audio playback.  This supports playback
45*    of data from memory.  It can be routed either to a mixer or directly
46*    to output devices.
47*
48* Revision History:
49*
50* $brcm_Log: /nexus/modules/audio/7422/src/nexus_audio_playback.c $
51*
52* 5   8/15/11 1:59p jgarrett
53* SW7346-439: Coverity CID 34704
54*
55* 4   5/25/11 5:16p jgarrett
56* SW7425-408: Adding BDBG_OBJECT to input/output types and MS11 features
57*
58* 3   4/25/11 9:45p jgarrett
59* SW7425-437: Supporting ANY_ID
60*
61* 2   2/22/11 5:44p jgarrett
62* SW7422-146: Implemented type renaming based on filter graph review
63*  comments
64*
65* 1   12/17/10 3:56p jgarrett
66* SW7422-146: Adding initial nexus on APE for 7422
67*
68***************************************************************************/
69#include "nexus_audio_module.h"
70
71BDBG_MODULE(nexus_audio_playback);
72
73#if NEXUS_NUM_AUDIO_PLAYBACKS
74BDBG_OBJECT_ID(NEXUS_AudioPlayback);
75
76/***************************************************************************
77Summary:
78Handle for audio playback
79***************************************************************************/
80typedef struct NEXUS_AudioPlayback
81{
82    BDBG_OBJECT(NEXUS_AudioPlayback)
83    NEXUS_AudioInputObject connector;
84    BAPE_PlaybackHandle channel;
85    NEXUS_TaskCallbackHandle appCallback;
86    NEXUS_AudioPlaybackOpenSettings openSettings;
87    NEXUS_AudioPlaybackStartSettings startSettings;
88    NEXUS_AudioPlaybackSettings settings;
89    BKNI_EventHandle event;
90    NEXUS_EventCallbackHandle eventCallback;
91    void *pLastAddress;
92    size_t bytesPlayed;
93    bool started;
94    bool opened;
95} NEXUS_AudioPlayback;
96
97static NEXUS_AudioPlayback g_playbacks[NEXUS_NUM_AUDIO_PLAYBACKS];
98static void NEXUS_AudioPlayback_P_DataEvent(void *pParam);
99static void NEXUS_AudioPlayback_P_BufferFree_isr(void *pParam1, int param2);
100
101/***************************************************************************
102Summary:
103Get default settings for an audio playback channel
104***************************************************************************/
105void NEXUS_AudioPlayback_GetDefaultOpenSettings(
106    NEXUS_AudioPlaybackOpenSettings *pSettings      /* [out] default settings */
107    )
108{
109    BAPE_PlaybackOpenSettings openSettings;
110    BDBG_ASSERT(NULL != pSettings);
111    BAPE_Playback_GetDefaultOpenSettings(&openSettings);
112    pSettings->fifoSize = openSettings.bufferSize;
113    pSettings->threshold = openSettings.watermarkThreshold;
114}
115
116/***************************************************************************
117Summary:
118Open an audio playback channel
119***************************************************************************/
120NEXUS_AudioPlaybackHandle NEXUS_AudioPlayback_Open(     /* attr{destructor=NEXUS_AudioPlayback_Close}  */
121    unsigned index,
122    const NEXUS_AudioPlaybackOpenSettings *pSettings    /* Pass NULL for default settings */
123    )
124{
125    BERR_Code errCode;
126    NEXUS_AudioPlayback *pChannel;
127    NEXUS_AudioPlaybackOpenSettings defaultSettings;
128    BAPE_PlaybackOpenSettings openSettings;
129    BAPE_PlaybackInterruptHandlers interrupts;
130    BAPE_Connector input;
131
132    if (index == NEXUS_ANY_ID) {
133        for (index=0;index<NEXUS_NUM_AUDIO_PLAYBACKS;index++) {
134            if (!g_playbacks[index].opened) break;
135        }
136        if (index == NEXUS_NUM_AUDIO_PLAYBACKS) {
137            BDBG_ERR(("No more playback channels available"));
138            return NULL;
139        }
140    }
141    if ( index >= NEXUS_NUM_AUDIO_PLAYBACKS )
142    {
143        BDBG_ERR(("Playback channel %u not available on this chipset", index));
144        errCode = BERR_TRACE(BERR_INVALID_PARAMETER);
145        return NULL;
146    }
147
148    pChannel = &g_playbacks[index];
149    if ( pChannel->opened )
150    {
151        BDBG_ERR(("Playback channel %u already open", index));
152        errCode = BERR_TRACE(BERR_INVALID_PARAMETER);
153        return NULL;
154    }
155    BKNI_Memset(pChannel, 0, sizeof(*pChannel));
156    pChannel->settings.leftVolume = pChannel->settings.rightVolume = NEXUS_AUDIO_VOLUME_LINEAR_NORMAL;
157
158    if ( NULL == pSettings )
159    {
160        NEXUS_AudioPlayback_GetDefaultOpenSettings(&defaultSettings);
161        pSettings = &defaultSettings;
162    }
163
164    /* Setup Connector */
165    NEXUS_AUDIO_INPUT_INIT(&pChannel->connector, NEXUS_AudioInputType_ePlayback, pChannel);
166    pChannel->connector.format = NEXUS_AudioInputFormat_ePcmStereo;
167
168    /* Open Playback Channel */
169    BAPE_Playback_GetDefaultOpenSettings(&openSettings);
170    openSettings.numBuffers = 1;
171    openSettings.bufferSize = pSettings->fifoSize;
172    openSettings.watermarkThreshold = pSettings->threshold;
173    errCode = BAPE_Playback_Open(NEXUS_AUDIO_DEVICE_HANDLE,
174                                 index,
175                                 &openSettings,
176                                 &pChannel->channel);
177    if ( errCode )
178    {
179        errCode = BERR_TRACE(errCode);
180        goto err_channel;
181    }
182    BAPE_Playback_GetConnector(pChannel->channel, &input);
183    pChannel->connector.port = (uint32_t)input;
184
185    BAPE_Playback_GetInterruptHandlers(pChannel->channel, &interrupts);
186    interrupts.watermark.pCallback_isr = NEXUS_AudioPlayback_P_BufferFree_isr;
187    interrupts.watermark.pParam1 = pChannel;
188    errCode = BAPE_Playback_SetInterruptHandlers(pChannel->channel, &interrupts);
189    if ( errCode )
190    {
191        errCode = BERR_TRACE(errCode);
192        goto err_interrupt;
193    }
194
195    pChannel->appCallback = NEXUS_TaskCallback_Create(pChannel, NULL);
196    if ( NULL == pChannel->appCallback )
197    {
198        errCode = BERR_TRACE(BERR_OS_ERROR);
199        goto err_callback;
200    }
201
202    errCode = BKNI_CreateEvent(&pChannel->event);
203    if ( errCode )
204    {
205        errCode = BERR_TRACE(errCode);
206        goto err_event;
207    }
208
209    pChannel->eventCallback = NEXUS_RegisterEvent(pChannel->event, NEXUS_AudioPlayback_P_DataEvent, pChannel);
210    if ( NULL == pChannel->eventCallback )
211    {
212        errCode = BERR_TRACE(BERR_OS_ERROR);
213        goto err_event_callback;
214    }
215
216    /* Success */
217    BDBG_OBJECT_SET(pChannel, NEXUS_AudioPlayback);
218    pChannel->opened = true;
219    return pChannel;
220
221err_event_callback:
222    BKNI_DestroyEvent(pChannel->event);
223err_event:
224    NEXUS_TaskCallback_Destroy(pChannel->appCallback);   
225err_callback:
226err_interrupt:
227    BAPE_Playback_Close(pChannel->channel);
228err_channel:
229    BKNI_Memset(pChannel, 0, sizeof(*pChannel));
230    return NULL;
231}
232
233/***************************************************************************
234Summary:
235Close an audio playback channel
236***************************************************************************/
237void NEXUS_AudioPlayback_Close(
238    NEXUS_AudioPlaybackHandle handle
239    )
240{
241    BDBG_OBJECT_ASSERT(handle, NEXUS_AudioPlayback);
242    if ( handle->started )
243    {
244        BDBG_WRN(("Automatically stopping audio playback channel %p on close", handle));
245        NEXUS_AudioPlayback_Stop(handle);
246    }
247    NEXUS_AudioInput_Shutdown(&handle->connector);
248    BAPE_Playback_Close(handle->channel);
249    NEXUS_TaskCallback_Destroy(handle->appCallback);
250    NEXUS_UnregisterEvent(handle->eventCallback);
251    BKNI_DestroyEvent(handle->event);
252    BKNI_Memset(handle, 0, sizeof(NEXUS_AudioPlayback));
253}
254
255void NEXUS_AudioPlayback_Flush(
256    NEXUS_AudioPlaybackHandle handle
257    )
258{
259    BDBG_OBJECT_ASSERT(handle, NEXUS_AudioPlayback);
260    if ( handle->started )
261    {
262        (void)BAPE_Playback_Flush(handle->channel);
263    }
264}
265
266/***************************************************************************
267Summary:
268Get default settings for an audio playback channel
269***************************************************************************/
270void NEXUS_AudioPlayback_GetDefaultStartSettings(
271    NEXUS_AudioPlaybackStartSettings *pSettings  /* [out] Default Settings */
272    )
273{
274    BAPE_PlaybackStartSettings startSettings;
275
276    BDBG_ASSERT(NULL != pSettings);
277    BKNI_Memset(pSettings, 0, sizeof(*pSettings));
278
279    BAPE_Playback_GetDefaultStartSettings(&startSettings);
280
281    /* Setup default parameters (the non-zero ones) */
282    pSettings->sampleRate = startSettings.sampleRate;
283    pSettings->bitsPerSample = startSettings.bitsPerSample;
284    pSettings->stereo = startSettings.isStereo;
285    pSettings->signedData = startSettings.isSigned;
286    pSettings->startThreshold = (size_t)startSettings.startThreshold;
287}
288
289/***************************************************************************
290Summary:
291Start playing data data from an audio playback channel
292***************************************************************************/
293NEXUS_Error NEXUS_AudioPlayback_Start(
294    NEXUS_AudioPlaybackHandle handle,
295    const NEXUS_AudioPlaybackStartSettings *pSettings
296    )
297{
298    NEXUS_Error errCode;
299    NEXUS_AudioOutputList outputList;
300    BAPE_PlaybackStartSettings startSettings;
301
302    BDBG_OBJECT_ASSERT(handle, NEXUS_AudioPlayback);
303    BDBG_ASSERT(NULL != pSettings);
304
305    if ( handle->started )
306    {
307        BDBG_ERR(("Audio playback channel %p already started.", handle));
308        return BERR_TRACE(BERR_INVALID_PARAMETER);
309    }
310
311    /* Check that we have some outputs ready */
312    NEXUS_AudioInput_P_GetOutputs(&handle->connector, &outputList, false);
313    if ( NULL == outputList.outputs[0] )
314    {
315        BDBG_ERR(("No outputs are connected to this playback channel.  Please connect outputs before starting."));
316        return BERR_TRACE(BERR_NOT_SUPPORTED);
317    }
318
319    BAPE_Playback_GetDefaultStartSettings(&startSettings);
320    startSettings.sampleRate = pSettings->sampleRate;
321    startSettings.bitsPerSample = pSettings->bitsPerSample;
322    startSettings.isStereo = pSettings->stereo;
323    startSettings.isSigned = pSettings->signedData;
324    startSettings.startThreshold = pSettings->startThreshold;
325    startSettings.loopEnabled = pSettings->loopAround;
326
327    NEXUS_TaskCallback_Set(handle->appCallback, &pSettings->dataCallback);
328
329    /* Connect to outputs */
330    NEXUS_AudioInput_P_PrepareToStart(&handle->connector);
331
332    /* Reset bytes played */
333    handle->bytesPlayed = 0;
334    /* Save Settings */
335    handle->started = true;
336    handle->startSettings = *pSettings; 
337    handle->pLastAddress = NULL;
338
339    /* Start Playback */
340    errCode = BAPE_Playback_Start(handle->channel, &startSettings);
341    if ( errCode )
342    {
343        handle->started = false;
344        return BERR_TRACE(errCode);
345    }
346
347    return BERR_SUCCESS;
348}
349
350/***************************************************************************
351Summary:
352Stop playing data from an audio playback channel
353***************************************************************************/
354void NEXUS_AudioPlayback_Stop(
355    NEXUS_AudioPlaybackHandle handle
356    )
357{
358    BDBG_OBJECT_ASSERT(handle, NEXUS_AudioPlayback);
359
360    if ( handle->started )
361    {
362        BAPE_Playback_Stop(handle->channel);
363        handle->started = false;
364    }
365}
366
367/***************************************************************************
368Summary:
369Get a pointer and size for the next location in the buffer which can accept data
370
371Description:
372NEXUS_AudioPlayback_GetBuffer is non-destructive. You can safely call it multiple times.
373***************************************************************************/
374NEXUS_Error NEXUS_AudioPlayback_GetBuffer(
375    NEXUS_AudioPlaybackHandle handle,
376    void **pBuffer, /* [out] attr{memory=cached} pointer to memory mapped region that is ready for playback data */
377    size_t *pSize   /* [out] total number of writeable, contiguous bytes which buffer is pointing to */
378    )
379{
380    BERR_Code errCode;
381    BAPE_BufferDescriptor bufferDescriptor;
382
383    BDBG_OBJECT_ASSERT(handle, NEXUS_AudioPlayback);
384    BDBG_ASSERT(NULL != pBuffer);
385    BDBG_ASSERT(NULL != pSize);
386
387    errCode = BAPE_Playback_GetBuffer(handle->channel, &bufferDescriptor);
388    if ( errCode ) 
389    {
390        return BERR_TRACE(errCode);
391    }
392    *pSize = bufferDescriptor.bufferSize;
393
394    if ( bufferDescriptor.bufferSize > 0 )
395    {
396        errCode = BMEM_Heap_ConvertAddressToCached(g_pCoreHandles->heap[0], bufferDescriptor.buffers[BAPE_Channel_eLeft].pBuffer, pBuffer);
397        if ( errCode )
398        {
399            return BERR_TRACE(errCode);
400        }
401    }
402    else
403    {
404        *pBuffer = NULL;
405    }
406
407    handle->pLastAddress = *pBuffer;  /* Save this for the cacheflush on write complete */
408    BDBG_MSG(("NEXUS_AudioPlayback_GetBuffer %p, %d", *pBuffer, *pSize));
409
410    return BERR_SUCCESS;
411}
412
413/***************************************************************************
414Summary:
415Notify AudioPlayback how much data was added into the buffer.
416
417Description:
418You can only call NEXUS_AudioPlayback_ReadComplete once after a
419NEXUS_AudioPlayback_GetBuffer call.  After calling it, you must call
420NEXUS_AudioPlayback_GetBuffer before adding more data.
421***************************************************************************/
422NEXUS_Error NEXUS_AudioPlayback_ReadComplete(
423    NEXUS_AudioPlaybackHandle handle,
424    size_t amountWritten            /* The number of bytes written to the buffer */
425    )
426{
427    BERR_Code errCode;
428
429    BDBG_OBJECT_ASSERT(handle, NEXUS_AudioPlayback);
430
431    /* this code assumes (and asserts) that there will be at least one get_buffer before each write_complete.
432    this should be true regardless of cache flush, but it makes the cache flush algo easier too. */
433    if ( NULL == handle->pLastAddress )
434    {
435        BDBG_ERR(("You must call NEXUS_AudioPlayback_GetBuffer before calling NEXUS_AudioPlayback_ReadComplete"));
436        BDBG_ASSERT(NULL != handle->pLastAddress);
437        return BERR_TRACE(BERR_NOT_SUPPORTED);
438    }
439    if ( amountWritten > 0 )
440    {
441        BMEM_Heap_FlushCache(g_pCoreHandles->heap[0], handle->pLastAddress, amountWritten);       
442    }
443    handle->pLastAddress = NULL;
444
445    errCode = BAPE_Playback_CommitData(handle->channel, amountWritten);
446    if ( errCode )
447    {
448        return BERR_TRACE(errCode);
449    }
450    BDBG_MSG(("NEXUS_AudioPlayback_ReadComplete received %u bytes", amountWritten));
451
452    /* Increment bytes played for status purposes */
453    handle->bytesPlayed += amountWritten;
454
455    return BERR_SUCCESS;
456}
457
458/***************************************************************************
459Summary:
460Get current status of the audio playback channel
461***************************************************************************/
462void NEXUS_AudioPlayback_GetStatus(
463    NEXUS_AudioPlaybackHandle handle,
464    NEXUS_AudioPlaybackStatus *pStatus      /* [out] Current Status */
465    )
466{
467    BAPE_PlaybackStatus status;
468
469    BDBG_OBJECT_ASSERT(handle, NEXUS_AudioPlayback);
470    BDBG_ASSERT(NULL != pStatus);
471
472    BKNI_Memset(pStatus, 0, sizeof(*pStatus));
473
474    pStatus->started = handle->started;
475    pStatus->startSettings = handle->startSettings;
476
477    BAPE_Playback_GetStatus(handle->channel, &status);
478    pStatus->fifoSize = status.fifoSize;
479    pStatus->queuedBytes = status.queuedBytes;
480}
481
482/***************************************************************************
483Summary:
484Get an audio connector for use with downstream components. 
485**************************************************************************/
486NEXUS_AudioInput NEXUS_AudioPlayback_GetConnector( /* attr{shutdown=NEXUS_AudioInput_Shutdown} */
487    NEXUS_AudioPlaybackHandle handle
488    )
489{
490    BDBG_OBJECT_ASSERT(handle, NEXUS_AudioPlayback);
491    return &handle->connector;
492}
493
494/* Handle the raptor buffer interrupt */
495static void NEXUS_AudioPlayback_P_BufferFree_isr(void *pParam1, int param2)
496{
497    NEXUS_AudioPlaybackHandle handle = pParam1;
498
499    BDBG_OBJECT_ASSERT(handle, NEXUS_AudioPlayback);
500    BSTD_UNUSED(param2);
501
502    BKNI_SetEvent(handle->event);
503}
504
505/* Handle the raptor data ready callback */
506static void NEXUS_AudioPlayback_P_DataEvent(void *pParam)
507{
508    NEXUS_Error errCode;
509    NEXUS_AudioPlaybackHandle handle = pParam;
510    void *pBuffer;
511    size_t size=0;
512
513    BDBG_OBJECT_ASSERT(handle, NEXUS_AudioPlayback);
514
515    /* non-blocking get of buffer space */
516    /* If it fails, or if there's no space available, don't send a callback */
517    errCode = NEXUS_AudioPlayback_GetBuffer(handle, &pBuffer, &size);
518    if ( errCode )
519    {
520        BDBG_MSG(("No space available"));
521        return;
522    }
523    else if ( size == 0 )
524    {
525        NEXUS_AudioPlayback_ReadComplete(handle, 0);
526        return;
527    }
528
529    /* call back to the user with the space available -- this will do nothing if no callback is present */
530    NEXUS_TaskCallback_Fire(handle->appCallback);
531}
532
533/* Private routine to get channel state */
534bool NEXUS_AudioPlayback_P_IsRunning(NEXUS_AudioPlaybackHandle handle)
535{
536    BDBG_OBJECT_ASSERT(handle, NEXUS_AudioPlayback);
537    return handle->started;
538}
539
540/***************************************************************************
541Summary:
542Get current setting of the audio playback channel
543***************************************************************************/
544void NEXUS_AudioPlayback_GetSettings(
545    NEXUS_AudioPlaybackHandle handle,
546    NEXUS_AudioPlaybackSettings *pSettings  /* [out] Current settings */
547    )
548{
549    BDBG_OBJECT_ASSERT(handle, NEXUS_AudioPlayback);
550    BDBG_ASSERT(NULL != pSettings);
551    *pSettings = handle->settings;
552}
553
554/***************************************************************************
555Summary:
556Set current setting of the audio playback channel
557***************************************************************************/
558NEXUS_Error NEXUS_AudioPlayback_SetSettings(
559    NEXUS_AudioPlaybackHandle handle,
560    const NEXUS_AudioPlaybackSettings *pSettings
561    )
562{
563    BAPE_MixerInputVolume vol;
564    NEXUS_Error errCode;
565
566    BDBG_OBJECT_ASSERT(handle, NEXUS_AudioPlayback);
567    BDBG_ASSERT(NULL != pSettings);
568
569    NEXUS_AudioInput_P_GetVolume(&handle->connector, &vol);
570    vol.coefficients[BAPE_Channel_eLeft][BAPE_Channel_eLeft] = pSettings->leftVolume;
571    vol.coefficients[BAPE_Channel_eRight][BAPE_Channel_eRight] = pSettings->rightVolume;
572    vol.muted = pSettings->muted;
573    errCode = NEXUS_AudioInput_P_SetVolume(&handle->connector, &vol);
574    if ( errCode )
575    {
576        return BERR_TRACE(errCode);
577    }
578
579    handle->settings = *pSettings;
580
581    return BERR_SUCCESS;
582}
583
584#else
585/***************************************************************************
586Summary:
587Get default settings for an audio playback channel
588***************************************************************************/
589void NEXUS_AudioPlayback_GetDefaultOpenSettings(
590    NEXUS_AudioPlaybackOpenSettings *pSettings      /* [out] default settings */
591    )
592{
593    BSTD_UNUSED(pSettings);
594}
595
596/***************************************************************************
597Summary:
598Open an audio playback channel
599***************************************************************************/
600NEXUS_AudioPlaybackHandle NEXUS_AudioPlayback_Open(     /* attr{destructor=NEXUS_AudioPlayback_Close}  */
601    unsigned index,
602    const NEXUS_AudioPlaybackOpenSettings *pSettings    /* Pass NULL for default settings */
603    )
604{
605    NEXUS_Error errCode;
606    BSTD_UNUSED(index);
607    BSTD_UNUSED(pSettings);
608    errCode = BERR_TRACE(BERR_NOT_SUPPORTED);
609    return NULL;
610}
611
612/***************************************************************************
613Summary:
614Close an audio playback channel
615***************************************************************************/
616void NEXUS_AudioPlayback_Close(
617    NEXUS_AudioPlaybackHandle handle
618    )
619{
620    BSTD_UNUSED(handle);
621}
622
623/***************************************************************************
624Summary:
625Get default settings for an audio playback channel
626***************************************************************************/
627void NEXUS_AudioPlayback_GetDefaultStartSettings(
628    NEXUS_AudioPlaybackStartSettings *pSettings  /* [out] Default Settings */
629    )
630{
631    BSTD_UNUSED(pSettings);
632}
633
634/***************************************************************************
635Summary:
636Start playing data data from an audio playback channel
637***************************************************************************/
638NEXUS_Error NEXUS_AudioPlayback_Start(
639    NEXUS_AudioPlaybackHandle handle,
640    const NEXUS_AudioPlaybackStartSettings *pSettings
641    )
642{
643    BSTD_UNUSED(handle);
644    BSTD_UNUSED(pSettings);
645    return BERR_TRACE(BERR_NOT_SUPPORTED);
646}
647
648/***************************************************************************
649Summary:
650Stop playing data from an audio playback channel.
651
652Description:
653This will stop the channel and flush all data from the FIFO.
654***************************************************************************/
655void NEXUS_AudioPlayback_Stop(
656    NEXUS_AudioPlaybackHandle handle
657    )
658{
659    BSTD_UNUSED(handle);
660}
661
662/***************************************************************************
663Summary:
664Get a pointer and size for the next location in the buffer which can accept data
665
666Description:
667NEXUS_AudioPlayback_GetBuffer is non-destructive. You can safely call it multiple times.
668***************************************************************************/
669NEXUS_Error NEXUS_AudioPlayback_GetBuffer(
670    NEXUS_AudioPlaybackHandle handle,
671    void **pBuffer, /* [out] attr{memory=cached} pointer to memory mapped region that is ready for playback data */
672    size_t *pSize   /* [out] total number of writeable, contiguous bytes which buffer is pointing to */
673    )
674{
675    BSTD_UNUSED(handle);
676    BSTD_UNUSED(pBuffer);
677    BSTD_UNUSED(pSize);
678    return BERR_TRACE(BERR_NOT_SUPPORTED);
679}
680
681/***************************************************************************
682Summary:
683Notify AudioPlayback how much data was added into the buffer.
684
685Description:
686You can only call NEXUS_AudioPlayback_ReadComplete once after a
687NEXUS_AudioPlayback_GetBuffer call.  After calling it, you must call
688NEXUS_AudioPlayback_GetBuffer before adding more data.
689***************************************************************************/
690NEXUS_Error NEXUS_AudioPlayback_ReadComplete(
691    NEXUS_AudioPlaybackHandle handle,
692    size_t amountWritten            /* The number of bytes written to the buffer */
693    )
694{
695    BSTD_UNUSED(handle);
696    BSTD_UNUSED(amountWritten);
697    return BERR_TRACE(BERR_NOT_SUPPORTED);
698}
699
700/***************************************************************************
701Summary:
702Get current status of the audio playback channel
703***************************************************************************/
704void NEXUS_AudioPlayback_GetStatus(
705    NEXUS_AudioPlaybackHandle handle,
706    NEXUS_AudioPlaybackStatus *pStatus      /* [out] Current Status */
707    )
708{
709    BSTD_UNUSED(handle);
710    BSTD_UNUSED(pStatus);
711}
712
713/***************************************************************************
714Summary:
715Get an audio connector for use with downstream components. 
716**************************************************************************/
717NEXUS_AudioInput NEXUS_AudioPlayback_GetConnector( /* attr{shutdown=NEXUS_AudioInput_Shutdown} */
718    NEXUS_AudioPlaybackHandle handle
719    )
720{
721    BSTD_UNUSED(handle);
722    return NULL;
723}
724
725/***************************************************************************
726Summary:
727Get current setting of the audio playback channel
728***************************************************************************/
729void NEXUS_AudioPlayback_GetSettings(
730    NEXUS_AudioPlaybackHandle handle,
731    NEXUS_AudioPlaybackSettings *pSettings  /* [out] Current settings */
732    )
733{
734    BSTD_UNUSED(handle);
735    BSTD_UNUSED(pSettings);
736}
737
738/***************************************************************************
739Summary:
740Set current setting of the audio playback channel
741***************************************************************************/
742NEXUS_Error NEXUS_AudioPlayback_SetSettings(
743    NEXUS_AudioPlaybackHandle handle,
744    const NEXUS_AudioPlaybackSettings *pSettings
745    )
746{
747    BSTD_UNUSED(handle);
748    BSTD_UNUSED(pSettings);
749    return BERR_TRACE(BERR_NOT_SUPPORTED);
750}
751
752void NEXUS_AudioPlayback_Flush(
753    NEXUS_AudioPlaybackHandle handle
754    )
755{
756    BSTD_UNUSED(handle);
757}
758
759#endif /* #if NEXUS_NUM_AUDIO_PLAYBACKS */
760
Note: See TracBrowser for help on using the repository browser.