summaryrefslogtreecommitdiff
path: root/dgedit/canvastoollisten.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2013-04-23 20:43:59 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2013-04-23 20:43:59 +0200
commiteafdef4a5e7bb6cbed75b17a38a9b0e30c6e51a6 (patch)
tree61e74113c3b38df8aff60a764d36a884da1a597a /dgedit/canvastoollisten.cc
parent75ca97372cdcf9b42ada94bfdd13589d677cba91 (diff)
Add some sliders to control internal parameters of the editor.
Diffstat (limited to 'dgedit/canvastoollisten.cc')
-rw-r--r--dgedit/canvastoollisten.cc14
1 files changed, 13 insertions, 1 deletions
diff --git a/dgedit/canvastoollisten.cc b/dgedit/canvastoollisten.cc
index 4254137..f638f93 100644
--- a/dgedit/canvastoollisten.cc
+++ b/dgedit/canvastoollisten.cc
@@ -43,6 +43,8 @@ Player::Player(Canvas *c)
sf.byte_format = AO_FMT_NATIVE;
dev = ao_open_live(ao_default_driver_id(), &sf, 0);
+
+ volume = 1000;
}
Player::~Player()
@@ -57,7 +59,7 @@ void Player::run()
if(playing) {
short s[BUFSZ];
for(size_t i = 0; i < BUFSZ; i++) {
- if(i + pos < canvas->size) s[i] = canvas->data[pos + i] * ((2<<16) - 1);
+ if(i + pos < canvas->size) s[i] = canvas->data[pos + i] * volume;
else {
s[i] = 0;
playing = false;
@@ -75,6 +77,11 @@ void Player::run()
}
}
+void Player::setVolume(double v)
+{
+ volume = v;
+}
+
CanvasToolListen::CanvasToolListen(Canvas *c)
: player(c)
{
@@ -128,3 +135,8 @@ void CanvasToolListen::update()
canvas->update(r);
lastpos = pos;
}
+
+void CanvasToolListen::setVolume(int v)
+{
+ player.setVolume(v);
+}