audioInfo.cpp 1.91 KB
Newer Older
jcaceres's avatar
jcaceres committed
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
/**********************************************************************
 * File: audioInfo.cpp
 **********************************************************************
 * A project of the SoundWIRE research group at CCRMA
 * http://www-ccrma.stanford.edu/groups/soundwire/
 * --------------------------------------------------------------------
 * Coded by Daniel Walling (dwalling@ccrma.stanford.edu)
 * --------------------------------------------------------------------
 */

#include "audioInfo.h"
#include <iostream.h>

AudioInfo::AudioInfo (int sampleRate, int bytesPerSample, int framesPerBuffer,
		      int numChans, int netChans, int secondsBetweenPlucks,
		      bool jack, clock_t * lastTick,
							int jack_alsa_readable_offset ):
sampleRate (sampleRate),
bytesPerSample (bytesPerSample),
numChans (numChans),
netHarpStrings (netChans),
framesPerBuffer (framesPerBuffer),
secondsBetweenPlucks (secondsBetweenPlucks),
jack (jack),
lastTickTime (lastTick),
jack_alsa_readable_offset (jack_alsa_readable_offset)
{
}

AudioInfo::~AudioInfo ()
{
}

int
AudioInfo::getSampleRate ()
{
	return (sampleRate);
}

int
AudioInfo::getBytesPerSample ()
{
	return (bytesPerSample);
}

int
AudioInfo::getNumChans ()
{
	if (getNumNetHarpStrings () > 0)
	{
		return (getNumNetHarpStrings ());
	}
	else
	{
		return (numChans);
	}
}

int
AudioInfo::getFramesPerBuffer ()
{
	return (framesPerBuffer);
}

void
AudioInfo::setFramesPerBuffer (int newFramesPerBuffer)
{
	framesPerBuffer = newFramesPerBuffer;
}

int
AudioInfo::getBytesPerBuffer ()
{
	return (getFramesPerBuffer () * getBytesPerSample () *
		getNumChans ());
}

int
AudioInfo::getNumNetHarpStrings ()
{
	return (netHarpStrings);
}

int
AudioInfo::getNumAudioChans ()
{
	return (numChans);
}

int
AudioInfo::getSecondsBetweenPlucks ()
{
	return (secondsBetweenPlucks);
}

int
AudioInfo::getJack_alsa_readable_offset()
{
	return (jack_alsa_readable_offset);	
}

bool AudioInfo::isJack ()
{
	return (jack);
}