audioInfo.h 2.55 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
/**********************************************************************
 * File: audioInfo.h
 **********************************************************************
 * A project of the SoundWIRE research group at CCRMA
 * http://www-ccrma.stanford.edu/groups/soundwire/
 * --------------------------------------------------------------------
 * Coded by Daniel Walling (dwalling@ccrma.stanford.edu)
 * --------------------------------------------------------------------
 */

#ifndef	_AUDIO_INFO_H
#define	_AUDIO_INFO_H

#include <time.h>

/**
 * @brief Contains all information relevant to audio buffers.
 */

typedef class AudioInfo 
{
  private:
    int sampleRate;     //!< Audio sample rate (e.g. 44100).
    int bytesPerSample; //!< Number of bytes per sample (e.g. INT16 = 2 bytes).
    int numChans;     //!< Number of audio channels.
    int netHarpStrings; //!< Number of network channels (NetHarp strings).
    int framesPerBuffer;//!< One frame is one sample from every channel.
    int secondsBetweenPlucks; //!< Seconds to wait between plucks of the NetHarp.
    
  public:
    bool jack;	//!< jack audio subsystem, otherwise RtAudio
    int jack_alsa_readable_offset; //!< offset to alsa input lowest channel number.

        /**
         * @brief Constructor.
         *
         * @param sampleRate - Audio sample rate.
         * @param bytesPerSample - sample byte depth.
         * @param numChans - number of audio channels.
         * @param netHarpStrings - number of strings for NetHarp.
         * @param framesPerBuffer - number of audio frames per audio buffer.
         * @param jack - using jack audio subsystem, otherwise RtAudio.
         * @param jack_alsa_readable_offset - offset to alsa input lowest channel number.
         */
    
    AudioInfo( int sampleRate, int bytesPerSample, int framesPerBuffer,
                          int numChans, int netHarpStrings, int secondsBetweenPlucks,
						  bool jack, clock_t *lastTick,
							int jack_alsa_readable_offset  );
    
    ~AudioInfo();

    int getSampleRate();
    
    int getBytesPerSample();
    
        /**
         * @brief Returns the number of channels in the audio buffers for streams:  Mas( numAudioChannels, numNetHarpChannels).
         */
    int getNumChans();

    int getFramesPerBuffer();
    
    void setFramesPerBuffer(int newFramesPerBuffer);
    
    int getBytesPerBuffer();
    
    int getNumNetHarpStrings();
    
    int getNumAudioChans();

    int getSecondsBetweenPlucks();

    bool isJack();

   clock_t *lastTickTime;

    int getJack_alsa_readable_offset();

} *AudioInfoT;

#endif