2 * Copyright (C) 2005-2008 by Pieter Palmers
4 * This file is part of FFADO
5 * FFADO = Free Firewire (pro-)audio drivers for linux
7 * FFADO is based upon FreeBoB.
9 * This program is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation, either version 2 of the License, or
12 * (at your option) version 3 of the License.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 #ifndef FIREWORKS_SESSION_BLOCK_H
25 #define FIREWORKS_SESSION_BLOCK_H
27 #include "debugmodule/debugmodule.h"
30 #include "efc/efc_cmds_ioconfig.h"
34 #define ECHO_SESSION_FILE_START_OFFSET 0x0040
36 // we only support version 2
37 #define SESSION_VERSION 0x00000200
39 #define ECHO_SESSION_MAX_PHY_AUDIO_IN 40
40 #define ECHO_SESSION_MAX_PHY_AUDIO_OUT 40
41 #define ECHO_SESSION_MAX_1394_REC_CHAN 40
42 #define ECHO_SESSION_MAX_1394_PLAY_CHAN 40
43 #define ECHO_SESSION_MAX_LABEL_SIZE 22
45 #define ECHO_SESSION_MUTE_BIT 1
46 #define ECHO_SESSION_SOLO_BIT 2
47 #define ECHO_SESSION_PAD_BIT 4
49 // Phantom power bit is set in the "flags"
50 #define ECHO_SESSION_FLAG_PHANTOM_POWER_BIT 31
51 #define ECHO_SESSION_FLAG_PHANTOM_POWER (1 << ECHO_SESSION_FLAG_PHANTOM_POWER_BIT)
54 #define ECHO_SESSION_CRC_START_OFFSET_BYTES ( sizeof(uint32_t) * 2 )
55 #define ECHO_SESSION_CRC_START_OFFSET_QUADS ( ECHO_SESSION_CRC_START_OFFSET_BYTES/sizeof(uint32_t) )
56 #define ECHO_SESSION_CRC_INITIAL_REMAINDER 0xFFFFFFFF
57 #define ECHO_SESSION_CRC_FINAL_XOR_VALUE 0xFFFFFFFF
68 char label
[ECHO_SESSION_MAX_LABEL_SIZE
];
75 char label
[ECHO_SESSION_MAX_LABEL_SIZE
];
82 char label
[ECHO_SESSION_MAX_LABEL_SIZE
];
87 InputSettings inputs
[ECHO_SESSION_MAX_PHY_AUDIO_IN
];
88 byte_t monitorpans
[ECHO_SESSION_MAX_PHY_AUDIO_IN
][ECHO_SESSION_MAX_PHY_AUDIO_OUT
];
89 byte_t monitorflags
[ECHO_SESSION_MAX_PHY_AUDIO_IN
][ECHO_SESSION_MAX_PHY_AUDIO_OUT
];
90 PlaybackSettings playbacks
[ECHO_SESSION_MAX_PHY_AUDIO_OUT
];
91 OutputSettings outputs
[ECHO_SESSION_MAX_PHY_AUDIO_OUT
];
100 int32_t mirror_channel
;
101 int32_t digital_mode
;
105 uint32_t monitorgains
[ECHO_SESSION_MAX_PHY_AUDIO_IN
][ECHO_SESSION_MAX_PHY_AUDIO_OUT
];
106 uint32_t playbackgains
[ECHO_SESSION_MAX_PHY_AUDIO_OUT
];
107 uint32_t outputgains
[ECHO_SESSION_MAX_PHY_AUDIO_OUT
];
109 IsoChannelMap ChannelMap2X
;
110 IsoChannelMap ChannelMap4X
;
118 bool loadFromDevice(Device
&);
119 bool saveToDevice(Device
&);
121 bool loadFromFile(std::string name
);
122 bool saveToFile(std::string name
);
124 bool loadFromMemory(void *buff
, size_t len
);
125 bool saveToMemory(void *buff
, size_t max_len
);
127 virtual void setVerboseLevel(int l
)
132 uint32_t calculateCRC();
133 uint32_t calculateCRC(void *memblock
, size_t max_len
);
139 DECLARE_DEBUG_MODULE
;
144 #endif //FIREWORKS_SESSION_BLOCK_H