OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
mci.h
Go to the documentation of this file.
1//----------------------------------------------------------------------------
2// ObjectWindows
3// Copyright (c) 1995, 1996 by Borland International, All Rights Reserved
4//
5/// \file
6/// Windows MCI (Media Control Interface) encapsulation classes.
7//----------------------------------------------------------------------------
8
9#if !defined(OWL_MCI_H)
10#define OWL_MCI_H
11
12#include <owl/private/defs.h>
13#if defined(BI_HAS_PRAGMA_ONCE)
14# pragma once
15#endif
16
17#include <owl/window.h>
18#include <mmsystem.h>
19
20
21namespace owl {
22
23#include <owl/preclass.h>
24
25class _OWLCLASS TMci;
26
27//
28/// \class TMciHiddenWindow
29// ~~~~~ ~~~~~~~~~~~~~~~~
30/// A private TWindow derivative used by TMci to capture events.
31//
33 public:
35
37
38 private:
39 TMci& Mci;
40
41 DECLARE_RESPONSE_TABLE(TMciHiddenWindow);
42};
43
44//
45/// \class TMci
46// ~~~~~ ~~~~
47/// TMci is a Windows MCI (Media Control Interface) encapsulation class.
48//
50 public:
51 // Constructors and destructors
52 //
53 TMci();
54 virtual ~TMci();
55
56 // Available commands on any MCI device
57 //
58 MCIERROR Open(const MCI_OPEN_PARMS&, DWORD_PTR flags = 0);
59 MCIERROR Close();
60 MCIERROR Play(const MCI_PLAY_PARMS&, DWORD_PTR flags = 0);
61 MCIERROR Stop(DWORD_PTR flags = 0);
62 MCIERROR Pause(DWORD_PTR flags = 0);
63 MCIERROR Resume(DWORD_PTR flags = 0);
64 MCIERROR Seek(const MCI_SEEK_PARMS&, DWORD_PTR flags = 0);
65 MCIERROR Seek(DWORD to, DWORD_PTR flags = 0);
66 MCIERROR Load(const tstring& fileName, DWORD_PTR flags = 0);
67
68 // Virtual function to override in derived classes to know when
69 // an MCI event is finished.
70 //
72
73 // State information
74 //
75 bool IsBusy() const;
76 void SetBusy(bool);
77
78 // General wrappers and properties
79 //
80 MCIDEVICEID GetDeviceId() const;
81 HWND GetCallbackWindow() const;
82 MCIERROR SendCommand(UINT msg, DWORD_PTR flags, DWORD_PTR param);
83 static MCIERROR SendCommand(MCIDEVICEID deviceId, UINT msg, DWORD_PTR flags, DWORD_PTR param);
84
85 private:
86 void SetBusyIfNeeded(DWORD_PTR flags);
87
88 MCIDEVICEID DeviceId; ///< Id for the MCI device
89 bool WaitingForNotification; ///< Flag for asynchronous busy
90 TWindow* Window; ///< Owner
91};
92
93//
94/// \class TMciWaveAudio
95// ~~~~~ ~~~~~~~~~~~~~
96/// Wrapper to play .WAV files.
97//
99 public:
100 TMciWaveAudio(LPCTSTR elementName = 0, LPCTSTR deviceName = 0,
101 uint16 id = 0);
102
103 TMciWaveAudio(const tstring& elementName, const tstring& deviceName, uint16 id = 0);
104
105 MCIERROR Play(DWORD_PTR flags = 0, DWORD from = 0, DWORD to = 0);
106};
107
108//
109/// \class TWinMM
110// ~~~~~ ~~~~~~
111/// delay loading WINMM.DLL
113 public:
114 static MCIERROR mciSendCommand(MCIDEVICEID, UINT msg, DWORD_PTR flags, DWORD_PTR param);
115 static TModule& GetModule();
116};
117
118#include <owl/posclass.h>
119
120
121//----------------------------------------------------------------------------
122// Inline implementations
123//
124
125//
126/// Returns the ID of the open MCI device.
127//
128inline uint TMci::GetDeviceId() const {
129 return DeviceId;
130}
131
132//
133/// Returns true if the MCI is currently busy doing something.
134//
135inline bool TMci::IsBusy() const {
136 return WaitingForNotification;
137}
138
139//
140/// Sets the busy flag for the MCI device.
141//
142inline void TMci::SetBusy(bool b) {
143 WaitingForNotification = b;
144}
145
146
147} // OWL namespace
148
149#endif // OWL_MCI_H
TMciHiddenWindow(TMci &, TModule *=0)
A hidden window created for the sole purpose of catching MCI messages.
Definition mci.cpp:55
TResult EvMciNotify(TParam1, TParam2)
Notifies the MCI class that the MCI event has finished.
Definition mci.cpp:67
TMci is a Windows MCI (Media Control Interface) encapsulation class.
Definition mci.h:49
MCIERROR Play(const MCI_PLAY_PARMS &, DWORD_PTR flags=0)
Plays the MCI device.
Definition mci.cpp:212
MCIDEVICEID GetDeviceId() const
Returns the ID of the open MCI device.
Definition mci.h:128
TMci()
Creates a hidden window for catching messages.
Definition mci.cpp:77
MCIERROR Close()
Stops the MCI device and closes it.
Definition mci.cpp:140
void SetBusy(bool)
Sets the busy flag for the MCI device.
Definition mci.h:142
HWND GetCallbackWindow() const
Returns the callback. If the window exists, the handle of the window is returned.
Definition mci.cpp:102
MCIERROR Open(const MCI_OPEN_PARMS &, DWORD_PTR flags=0)
Opens the MCI device.
Definition mci.cpp:125
MCIERROR Load(const tstring &fileName, DWORD_PTR flags=0)
Loads the file into the MCI device.
Definition mci.cpp:252
MCIERROR SendCommand(UINT msg, DWORD_PTR flags, DWORD_PTR param)
Sends the MCI command message to the device if it's not busy.
Definition mci.cpp:113
bool IsBusy() const
Returns true if the MCI is currently busy doing something.
Definition mci.h:135
MCIERROR Resume(DWORD_PTR flags=0)
Resumes playing of the MCI device.
Definition mci.cpp:185
MCIERROR Pause(DWORD_PTR flags=0)
Pauses the MCI device.
Definition mci.cpp:168
MCIERROR Seek(const MCI_SEEK_PARMS &, DWORD_PTR flags=0)
Seeks a particular position on the MCI device.
Definition mci.cpp:224
virtual TResult MciNotify(TParam1, TParam2)
The default MciNotify is to return 0.
Definition mci.cpp:268
MCIERROR Stop(DWORD_PTR flags=0)
Stops the MCI device.
Definition mci.cpp:151
MCIERROR Play(DWORD_PTR flags=0, DWORD from=0, DWORD to=0)
Plays the file on the waveaudio device.
Definition mciwav.cpp:59
TMciWaveAudio(LPCTSTR elementName=0, LPCTSTR deviceName=0, uint16 id=0)
Constructs an MCI waveaudio (.WAV) device.
Definition mciwav.cpp:35
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
Definition module.h:78
delay loading WINMM.DLL
Definition mci.h:112
static TModule & GetModule()
Definition mci.cpp:27
static MCIERROR mciSendCommand(MCIDEVICEID, UINT msg, DWORD_PTR flags, DWORD_PTR param)
Definition mci.cpp:37
TWindow, derived from TEventHandler and TStreamableBase, provides window-specific behavior and encaps...
Definition window.h:414
TWindow(TWindow *parent, LPCTSTR title=nullptr, TModule *module=nullptr)
Adds this to the child list of parent if nonzero, and calls EnableAutoCreate so that this will be cre...
Definition window.cpp:341
Object Windows Library (OWLNext Core).
Definition animctrl.h:22
LPARAM TParam2
Second parameter type.
Definition dispatch.h:55
WPARAM TParam1
First parameter type.
Definition dispatch.h:54
LRESULT TResult
Result type.
Definition dispatch.h:52
unsigned short uint16
Definition number.h:33
std::string tstring
Definition defs.h:79
unsigned int uint
Definition number.h:25
#define _OWLCLASS
Definition defs.h:338
Base window class TWindow definition, including HWND encapsulation.