xref: /aoo41x/main/vcl/inc/os2/salsound.hxx (revision fc9fd3f1)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _SV_SALSOUND_HXX
25 #define _SV_SALSOUND_HXX
26 
27 #include <tools/gen.hxx>
28 #include <sv.h>
29 #include <tools/string.hxx>
30 #include <salframe.hxx>
31 #ifndef _SV_SALSTYPE_HXX
32 #include <salstype.hxx>
33 #endif
34 #include <salsound.hxx>
35 
36 // ------------
37 // - SalSound -
38 // ------------
39 
40 class SalSound
41 {
42 private:
43 
44 	static HMODULE		mhMCILib;
45 	static ULONG		mnSoundState;
46 	static void*		mpMCIFnc;
47 	SALSOUNDPROC		mpProc;
48 	void*				mpInst;
49 	ULONG				mnStartTime;
50 	ULONG				mnPlayLen;
51 	HWND				mhSoundWnd;
52     USHORT				mnDeviceId;
53 	BOOL				mbLoop;
54 	BOOL				mbPaused;
55 
56 public:
57 
58     void                ImplSetError( ULONG nMciErr );
59 	void				ImplNotify( SoundNotification eNotification, ULONG nError );
60 
61 public:
62 
63 						SalSound();
64 						~SalSound();
65 
66 	BOOL				Create();
67 	static void			Release();
IsValid()68 	static BOOL			IsValid() { return( SOUND_STATE_VALID == SalSound::mnSoundState ); }
69 
70 	BOOL				Init( SalFrame* pFrame, const String& rSoundName, ULONG& rSoundLen );
71 	BOOL				Init( SalFrame* pFrame, const BYTE* pSound, ULONG nDataLen, ULONG& rSoundLen );
72 	void				Play( ULONG nStartTime, ULONG nPlayTime, BOOL bLoop );
73 	void				Stop();
74 	void				Pause();
75 
SetNotifyProc(void * pInst,SALSOUNDPROC pProc)76 	void				SetNotifyProc( void* pInst, SALSOUNDPROC pProc )
77 							{ mpInst = pInst; mpProc = pProc; }
78 };
79 
80 #endif // _SV_SALSOUND_HXX
81