-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathsetup.h
More file actions
executable file
·68 lines (54 loc) · 1.68 KB
/
setup.h
File metadata and controls
executable file
·68 lines (54 loc) · 1.68 KB
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
#pragma cling add_include_path("/srv/conda/envs/notebook/include/python3.7m")
#pragma cling add_library_path("/srv/conda/envs/notebook/lib")
#pragma cling add_include_path("/usr/local/include/python3.7m")
#pragma cling add_library_path("/usr/local/lib")
#pragma cling load("python3.7m")
#define WITHOUT_NUMPY 1
#include "matplotlib-cpp/matplotlibcpp.h"
#include "icst-audiofile/AudioFile.h"
#include "icst-audiofile/AudioFile.cpp"
namespace plt = matplotlibcpp;
#include <iostream>
#include <string>
#include <fstream>
#include "xtl/xbase64.hpp"
#include "xeus/xjson.hpp"
namespace im
{
struct image
{
inline image(const std::string& filename)
{
std::ifstream fin(filename, std::ios::binary);
m_buffer << fin.rdbuf();
}
std::stringstream m_buffer;
};
xeus::xjson mime_bundle_repr(const image& i)
{
auto bundle = xeus::xjson::object();
bundle["image/png"] = xtl::base64encode(i.m_buffer.str());
return bundle;
}
}
namespace au
{
struct audio
{
inline audio(const std::string& filename)
{
std::ifstream fin(filename, std::ios::binary);
m_buffer << fin.rdbuf();
}
std::stringstream m_buffer;
};
xeus::xjson mime_bundle_repr(const audio& a)
{
auto bundle = xeus::xjson::object();
bundle["text/html"] =
std::string("<audio controls=\"controls\"><source src=\"data:audio/wav;base64,")
+ xtl::base64encode(a.m_buffer.str()) +
"\" type=\"audio/wav\" /></audio>";
return bundle;
}
}