root/trunk/SMAC/SMACscom.h

Revision 1, 4.6 kB (checked in by gbooker, 3 years ago)

Initial Import

Line 
1 /*      Copyright:      © Copyright 2004 Apple Computer, Inc. All rights reserved.
2
3         Disclaimer:     IMPORTANT:  This Apple software is supplied to you by Apple Computer, Inc.
4                         ("Apple") in consideration of your agreement to the following terms, and your
5                         use, installation, modification or redistribution of this Apple software
6                         constitutes acceptance of these terms.  If you do not agree with these terms,
7                         please do not use, install, modify or redistribute this Apple software.
8
9                         In consideration of your agreement to abide by the following terms, and subject
10                         to these terms, Apple grants you a personal, non-exclusive license, under AppleÕs
11                         copyrights in this original Apple software (the "Apple Software"), to use,
12                         reproduce, modify and redistribute the Apple Software, with or without
13                         modifications, in source and/or binary forms; provided that if you redistribute
14                         the Apple Software in its entirety and without modifications, you must retain
15                         this notice and the following text and disclaimers in all such redistributions of
16                         the Apple Software.  Neither the name, trademarks, service marks or logos of
17                         Apple Computer, Inc. may be used to endorse or promote products derived from the
18                         Apple Software without specific prior written permission from Apple.  Except as
19                         expressly stated in this notice, no other rights or licenses, express or implied,
20                         are granted by Apple herein, including but not limited to any patent rights that
21                         may be infringed by your derivative works or by other works in which the Apple
22                         Software may be incorporated.
23
24                         The Apple Software is provided by Apple on an "AS IS" basis.  APPLE MAKES NO
25                         WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
26                         WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
27                         PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
28                         COMBINATION WITH YOUR PRODUCTS.
29
30                         IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
31                         CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
32                         GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33                         ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION
34                         OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT
35                         (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN
36                         ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 */
38 /*=============================================================================
39         SMACscom.h
40
41 =============================================================================*/
42 #if !defined(__SMACscom_h__)
43 #define __SMACscom_h__
44
45 //=============================================================================
46 //      Includes
47 //=============================================================================
48
49 #include <CAConditionalMacros.h>
50
51 #if TARGET_API_MAC_OSX && !USE_QTML_HEADERS
52 #include <Carbon/Carbon.h>
53 #else
54 #include <Sound.h>
55 #endif
56
57 #include "AudioCodec.h"
58
59 #define kMaxInputSamples 6144 * 2
60 //=============================================================================
61 //      SMACscom
62 //=============================================================================
63
64 class SMACscom
65 {
66
67 //      Construction/Destruction
68 public:
69                                                                 SMACscom(ComponentInstance inSelf, UInt32 inFormatID);
70         virtual                                         ~SMACscom();
71
72 //      Sound Component Methods
73 public:
74         virtual void                            SetSource(SoundSource inSourceID, ComponentInstance inSourceComponent);
75         virtual void                            SetOutput(SoundComponentData* inRequested, SoundComponentData** inActual);
76        
77         virtual void                            PlaySourceBuffer(SoundSource inSourceID, SoundParamBlock* inPB, SInt32 inActions);
78         virtual void                            StopSource(SInt16 inNumberSources, SoundSource* inSources);
79        
80         virtual void                            GetInfo(SoundSource inSourceID, OSType inSelector, void* outData);
81         virtual void                            SetInfo(SoundSource inSourceID, OSType inSelector, void* inData);
82        
83         virtual void                            GetSourceData(SoundComponentData** outData);
84
85 //      Implementation
86 protected:
87         virtual void                            GetCompressionInfo(CompressionInfo& outCompressionInfo) = 0;
88         virtual void                            GetCompressionParams(void* outData) = 0;
89         virtual ComponentInstance       SetCompressionParams(const void* inData) = 0;
90
91         ComponentInstance                       mSelf;
92         ComponentInstance                       mSourceComponent;
93         AudioCodec                                      mEncoder;
94         SoundSource                                     mSourceID;
95         SoundComponentData*                     mSourceData;
96         ExtendedSoundComponentData      mOutputData;
97         UInt32                                          mPacketFrameSize;
98         UInt32                                          mMaxPacketByteSize;
99         Byte*                                           mOutputBuffer;
100     Boolean                                             mSourceIsExhausted;
101         Boolean                                         mHasAltiVec;
102         float                                           mFloatBuffer[kMaxInputSamples];
103                
104 };
105
106 #endif
Note: See TracBrowser for help on using the browser.