diff options
Diffstat (limited to 'src/hd24info.cpp')
-rwxr-xr-x | src/hd24info.cpp | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/src/hd24info.cpp b/src/hd24info.cpp new file mode 100755 index 0000000..bcc834b --- /dev/null +++ b/src/hd24info.cpp | |||
@@ -0,0 +1,111 @@ | |||
1 | #include <iostream> | ||
2 | #include <string> | ||
3 | #include <convertlib.h> | ||
4 | #include <hd24fs.h> | ||
5 | |||
6 | using namespace std; | ||
7 | |||
8 | void showsongs(hd24project* currentproj) | ||
9 | { | ||
10 | int numsongs = currentproj->songcount(); | ||
11 | |||
12 | cout << "======================================================================" << endl; | ||
13 | |||
14 | if (numsongs == 0) | ||
15 | { | ||
16 | cout << " There are no songs in this project." << endl; | ||
17 | } | ||
18 | |||
19 | for (int i = 1; i <= numsongs; i++) | ||
20 | { | ||
21 | hd24song currsong = *(currentproj->getsong(i)); | ||
22 | string* songname1 = new string(""); | ||
23 | cout << " "; | ||
24 | |||
25 | if (i < 10) | ||
26 | { | ||
27 | cout << " "; | ||
28 | } | ||
29 | |||
30 | cout << i << ": "; | ||
31 | |||
32 | string* currsname = currsong.songname(); | ||
33 | *songname1 += *currsname; | ||
34 | |||
35 | cout << *(Convert::padright(*songname1, 20, " ")); | ||
36 | cout << *(currsong.display_duration()) << ", "; | ||
37 | |||
38 | string* chans = Convert::int2str(currsong.logical_channels()); | ||
39 | chans = Convert::padleft(*chans,2," "); | ||
40 | |||
41 | cout << *chans << "ch. " << currsong.samplerate() << " Hz "; | ||
42 | |||
43 | delete(currsname); | ||
44 | delete(songname1); | ||
45 | |||
46 | cout << endl; | ||
47 | } | ||
48 | } | ||
49 | |||
50 | void showprojects(hd24fs* currenthd24) | ||
51 | { | ||
52 | int numprojs = currenthd24->projectcount(); | ||
53 | |||
54 | for (int i = 1; i <= numprojs; i++) | ||
55 | { | ||
56 | hd24project currproj = *(currenthd24->getproject(i)); | ||
57 | string* projname1 = new string(""); | ||
58 | string* currpname = currproj.projectname(); | ||
59 | *projname1 += *currpname; | ||
60 | |||
61 | cout << "======================================================================" << endl << "Project " << i << ": "; | ||
62 | cout << *projname1 << endl; | ||
63 | |||
64 | showsongs (&currproj); | ||
65 | |||
66 | delete(currpname); | ||
67 | delete(projname1); | ||
68 | } | ||
69 | } | ||
70 | |||
71 | int main() | ||
72 | { | ||
73 | hd24fs* fsysp=new hd24fs((const char*)NULL); | ||
74 | hd24fs fsys=*fsysp; | ||
75 | string* volname; | ||
76 | |||
77 | if (!fsys.isOpen()) | ||
78 | { | ||
79 | cout << "Cannot open hd24 device." << endl; | ||
80 | return 1; | ||
81 | } | ||
82 | |||
83 | int devcount = fsys.hd24devicecount(); | ||
84 | |||
85 | if (devcount > 1) | ||
86 | { | ||
87 | cout << "Number of hd24 devices found: " << fsys.hd24devicecount() << endl; | ||
88 | } | ||
89 | |||
90 | for (int i = 0; i < devcount; i++) | ||
91 | { | ||
92 | hd24fs* currhd24 = new hd24fs((const char*)NULL,fsys.mode(), i); | ||
93 | |||
94 | if (devcount > 1) | ||
95 | { | ||
96 | cout << "Showing info for device #" << i << endl; | ||
97 | } | ||
98 | |||
99 | volname = currhd24->volumename(); | ||
100 | string vname = ""; | ||
101 | vname += *volname; | ||
102 | cout << "Volume name : " << vname<<endl; | ||
103 | delete volname; | ||
104 | |||
105 | cout << "Number of projects : " << currhd24->projectcount() << endl; | ||
106 | showprojects(currhd24); | ||
107 | delete currhd24; | ||
108 | } | ||
109 | |||
110 | return 0; | ||
111 | } | ||