/
OAL_Sample.cpp
121 lines (97 loc) · 2.62 KB
/
OAL_Sample.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/*
* Copyright 2007-2010 (C) - Frictional Games
*
* This file is part of OALWrapper
*
* For conditions of distribution and use, see copyright notice in LICENSE
*/
/**
@file OAL_Sample.cpp
@author Luis Rodero
@date 2006-10-02
@version 0.1
Definition of Base class for containing samples
*/
#include "OALWrapper/OAL_Types.h"
#include "OALWrapper/OAL_Device.h"
#include "OALWrapper/OAL_Helper.h"
#include "OALWrapper/OAL_Sample.h"
#include "OALWrapper/OAL_Buffer.h"
#include "OALWrapper/OAL_Source.h"
//------------------------------------------------------------------
///////////////////////////////////////////////////////////
// void Initialize ( void )
// - Creates a Buffer Object for the sample data
///////////////////////////////////////////////////////////
//------------------------------------------------------------------
cOAL_Sample::cOAL_Sample() : iOAL_AudioData(eOAL_AudioDataType_Sample,1)
{
}
//------------------------------------------------------------------
cOAL_Sample::~cOAL_Sample()
{
if(mlstBoundSources.empty()==false)
{
tSourceListIt it;
for(it=mlstBoundSources.begin(); it!=mlstBoundSources.end(); ++it)
{
cOAL_Source* pSource = *it;
pSource->Stop(false);
}
mlstBoundSources.clear();
}
}
//------------------------------------------------------------------
///////////////////////////////////////////////////////////
//
//
///////////////////////////////////////////////////////////
//------------------------------------------------------------------
ALuint* cOAL_Sample::GetOALBufferPointer()
{
return mvBuffers[0]->GetObjectIDPointer();
}
/*
string cOAL_Sample::GetDebugInfo()
{
char temp[200];
sprintf(temp, "Sample %s, Time %f, channels: %d\n", msFileName.c_str(), mfTotalTime, mlChannels);
return string(temp);
}
*/
//------------------------------------------------------------------
/*
void cOAL_Sample::Log( eOAL_LogVerbose aVerboseLevelReq, eOAL_LogMsg aMessageType, const char* asMessage, ...)
{
if(asMessage == NULL)
return;
if(!mbLogEnabled)
return;
if(aVerboseLevelReq < mLogVerboseLevel)
return;
string sMessage;
char text[2048];
va_list ap;
va_start(ap, asMessage);
vsprintf(text, asMessage, ap);
va_end(ap);
char sampleId[20];
sprintf(sampleId, "Sample %s - ", msFilename.c_str());
switch(aMessageType)
{
case eOAL_LogMsg_Command:
sMessage.append("[COMMAND] ");
break;
case eOAL_LogMsg_Info:
sMessage.append("[INFO] ");
break;
case eOAL_LogMsg_Error:
sMessage.append("[ERROR] ");
default:
break;
}
sMessage.append(sampleId).append(text);
Write(sMessage);
}
*/
//------------------------------------------------------------------