xref: /trunk/main/vcl/inc/os2/salsound.h (revision 24f6443d)
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_H
25 #define _SV_SALSOUND_H
26 
27 #include <tools/gen.hxx>
28 #include <sv.h>
29 #include <tools/string.hxx>
30 #include <vcl/salframe.hxx>
31 #ifndef _SV_SALSTYPE_HXX
32 #include <vcl/salstype.hxx>
33 #endif
34 #include <vcl/salsound.hxx>
35 
36 // ------------
37 // - SalSound -
38 // ------------
39 
40 //class SalSound
41 class Os2SalSound : public SalSound
42 {
43 private:
44 
45 	static HMODULE		mhMCILib;
46 	static ULONG		mnSoundState;
47 	static void*		mpMCIFnc;
48 	SALSOUNDPROC		mpProc;
49 	void*				mpInst;
50 	ULONG				mnStartTime;
51 	ULONG				mnPlayLen;
52 	HWND				mhSoundWnd;
53     USHORT				mnDeviceId;
54 	BOOL				mbLoop;
55 	BOOL				mbPaused;
56 
57 public:
58 
59     void                ImplSetError( ULONG nMciErr );
60 	void				ImplNotify( SoundNotification eNotification, ULONG nError );
61 
62 public:
63 
64 	BOOL				Create();
65 	//static BOOL			IsValid() { return( SOUND_STATE_VALID == Os2SalSound::mnSoundState ); }
66 	//BOOL				Init( SalFrame* pFrame, const String& rSoundName, ULONG& rSoundLen );
67 	//BOOL				Init( SalFrame* pFrame, const BYTE* pSound, ULONG nDataLen, ULONG& rSoundLen );
68 
SetNotifyProc(void * pInst,SALSOUNDPROC pProc)69 	void				SetNotifyProc( void* pInst, SALSOUNDPROC pProc )
70 							{ mpInst = pInst; mpProc = pProc; }
71 public:
72     Os2SalSound();
73     virtual ~Os2SalSound();
74 
75     virtual bool		IsValid();
76     virtual bool		Init( const String& rSoundName, ULONG& rSoundLen );
77    	virtual void		Play( ULONG nStartTime, ULONG nPlayTime, bool bLoop );
78 	virtual void		Stop();
79 	virtual void		Pause();
80 	virtual void		Continue();
81     virtual bool		IsLoopMode() const;
82 	virtual bool		IsPlaying() const;
83     virtual bool		IsPaused() const;
84 
85 	bool				ImplCreate();
86 	void				ImplDestroy();
87 	static void 		Release();
88 };
89 
90 #endif // _SV_SALSOUND_H
91