OWLNext
7.0
Borland's Object Windows Library for the modern age
Toggle main menu visibility
Loading...
Searching...
No Matches
mciwav.cpp
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
/// Implements TMciWaveAudio
7
//----------------------------------------------------------------------------
8
#include <
owl/pch.h
>
9
#include <
owl/mci.h
>
10
11
12
namespace
owl
{
13
14
OWL_DIAGINFO
;
15
16
//
17
// Initialize the structure for the waveaudio device.
18
//
19
static
void
InitParms(MCI_OPEN_PARMS& parms,
uint32
& command, LPCTSTR deviceName,
20
LPCTSTR elementName = 0,
uint16
id
= 0)
21
{
22
command = (
id
== 0) ? MCI_OPEN_TYPE : MCI_OPEN_TYPE_ID;
23
if
(elementName !=
nullptr
) {
24
command |= MCI_OPEN_ELEMENT;
25
parms.lpstrElementName = elementName;
26
}
27
28
parms.lpstrDeviceType = (
id
== 0) ? deviceName :
29
reinterpret_cast<LPTSTR>(static_cast<UINT_PTR>(
MkUint32
(static_cast<
uint16
>(reinterpret_cast<UINT_PTR>(deviceName)), id)));
30
}
31
32
//
33
/// Constructs an MCI waveaudio (.WAV) device.
34
//
35
TMciWaveAudio::TMciWaveAudio
(LPCTSTR elementName, LPCTSTR deviceName,
uint16
id
)
36
{
37
MCI_OPEN_PARMS parms;
38
uint32
command;
39
InitParms(parms, command, deviceName ==
nullptr
?
_T
(
"waveaudio"
) : deviceName,
40
elementName,
id
);
41
Open
(parms, command);
42
}
43
44
//
45
/// String-aware overload
46
//
47
TMciWaveAudio::TMciWaveAudio
(
const
tstring
& elementName,
const
tstring
& deviceName,
uint16
id
)
48
{
49
MCI_OPEN_PARMS parms;
50
uint32
command;
51
InitParms(parms, command, deviceName.c_str(), elementName.c_str(),
id
);
52
Open
(parms, command);
53
}
54
55
//
56
/// Plays the file on the waveaudio device.
57
//
58
MCIERROR
59
TMciWaveAudio::Play
(DWORD_PTR flags, DWORD from, DWORD to)
60
{
61
MCI_PLAY_PARMS parms;
62
63
if
(flags & MCI_NOTIFY)
64
parms.dwCallback =
reinterpret_cast<
DWORD_PTR
>
(
GetCallbackWindow
());
65
66
flags |= MCI_FROM;
67
parms.dwFrom = from;
68
69
if
(to != 0) {
70
flags |= MCI_TO;
71
parms.dwTo = to;
72
}
73
74
return
TMci::Play
(parms, flags);
75
}
76
77
}
// OWL namespace
78
/* ========================================================================== */
79
owl::TMci::Play
MCIERROR Play(const MCI_PLAY_PARMS &, DWORD_PTR flags=0)
Plays the MCI device.
Definition
mci.cpp:212
owl::TMci::GetCallbackWindow
HWND GetCallbackWindow() const
Returns the callback. If the window exists, the handle of the window is returned.
Definition
mci.cpp:102
owl::TMci::Open
MCIERROR Open(const MCI_OPEN_PARMS &, DWORD_PTR flags=0)
Opens the MCI device.
Definition
mci.cpp:125
owl::TMciWaveAudio::Play
MCIERROR Play(DWORD_PTR flags=0, DWORD from=0, DWORD to=0)
Plays the file on the waveaudio device.
Definition
mciwav.cpp:59
owl::TMciWaveAudio::TMciWaveAudio
TMciWaveAudio(LPCTSTR elementName=0, LPCTSTR deviceName=0, uint16 id=0)
Constructs an MCI waveaudio (.WAV) device.
Definition
mciwav.cpp:35
_T
#define _T(x)
Definition
cygwin.h:51
pch.h
mci.h
Windows MCI (Media Control Interface) encapsulation classes.
owl
Object Windows Library (OWLNext Core).
Definition
animctrl.h:22
owl::MkUint32
uint32 MkUint32(uint16 lo, uint16 hi)
Definition
defs.h:261
owl::uint32
unsigned long uint32
Definition
number.h:34
owl::OWL_DIAGINFO
OWL_DIAGINFO
Definition
animctrl.cpp:14
owl::uint16
unsigned short uint16
Definition
number.h:33
owl::tstring
std::string tstring
Definition
defs.h:79
source
owlcore
mciwav.cpp
Generated by
1.18.0