Clean up compiler warnings when compiling on 64-bit systems. These are mostly fixing...
[ffado.git] / libffado / src / fireworks / fireworks_session_block.h
blob9f1145a9797c0cc3046064e6983b113f06337606
1 /*
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"
28 #include <string>
30 #include "efc/efc_cmds_ioconfig.h"
32 namespace FireWorks {
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)
53 // CRC codes
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
59 class Device;
61 class Session
63 public:
64 typedef struct
66 byte_t shift;
67 byte_t pad;
68 char label[ECHO_SESSION_MAX_LABEL_SIZE];
69 } InputSettings;
71 typedef struct
73 byte_t mute;
74 byte_t solo;
75 char label[ECHO_SESSION_MAX_LABEL_SIZE];
76 } PlaybackSettings;
78 typedef struct
80 byte_t mute;
81 byte_t shift;
82 char label[ECHO_SESSION_MAX_LABEL_SIZE];
83 } OutputSettings;
85 typedef struct
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];
92 } SubSession;
94 typedef struct
96 uint32_t size_quads;
97 uint32_t crc;
98 uint32_t version;
99 uint32_t flags;
100 int32_t mirror_channel;
101 int32_t digital_mode;
102 int32_t clock;
103 int32_t rate;
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;
112 } SessionHeader;
114 public:
115 Session();
116 virtual ~Session();
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)
128 {setDebugLevel(l);};
129 void dumpData();
130 void show();
132 uint32_t calculateCRC();
133 uint32_t calculateCRC(void *memblock, size_t max_len);
135 SessionHeader h;
136 SubSession s;
138 private:
139 DECLARE_DEBUG_MODULE;
142 } // FireWorks
144 #endif //FIREWORKS_SESSION_BLOCK_H