* Removed a superfluous SetMouseEventMask() in the Slider constructor (at least
it was good enough to fix SetMouseEventMask() to no longer drop into the debugger). * Minor cleanup, renamed member variables to comply with our style guide. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15832 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,19 +1,12 @@
|
|||||||
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
|
/*
|
||||||
//
|
* Copyright (c) 2003-2005, Haiku, Inc.
|
||||||
// Copyright (c) 2003, OpenBeOS
|
* Distributed under the terms of the MIT license.
|
||||||
//
|
*
|
||||||
// This software is part of the OpenBeOS distribution and is covered
|
* Authors:
|
||||||
// by the OpenBeOS license.
|
* Jérôme Duval
|
||||||
//
|
* François Revol
|
||||||
//
|
*/
|
||||||
// Program: desklink
|
|
||||||
// Author: Jérôme DUVAL
|
|
||||||
// Description: VolumeControl and link items in Deskbar
|
|
||||||
// Created : October 20, 2003
|
|
||||||
// Modified by: Jérome Duval
|
|
||||||
// Modified by: François Revol, 10/31/2003
|
|
||||||
//
|
|
||||||
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
|
|
||||||
|
|
||||||
#include <MediaRoster.h>
|
#include <MediaRoster.h>
|
||||||
#include <MediaTheme.h>
|
#include <MediaTheme.h>
|
||||||
@@ -30,11 +23,15 @@
|
|||||||
#define VOLUME_CHANGED 'vlcg'
|
#define VOLUME_CHANGED 'vlcg'
|
||||||
#define VOLUME_UPDATED 'vlud'
|
#define VOLUME_UPDATED 'vlud'
|
||||||
|
|
||||||
|
#define REDZONESTART 151
|
||||||
|
|
||||||
|
|
||||||
VolumeSlider::VolumeSlider(BRect frame, bool dontBeep, int32 volumeWhich)
|
VolumeSlider::VolumeSlider(BRect frame, bool dontBeep, int32 volumeWhich)
|
||||||
: BWindow(frame, "VolumeSlider", B_BORDERED_WINDOW_LOOK, B_FLOATING_ALL_WINDOW_FEEL, B_ASYNCHRONOUS_CONTROLS | B_WILL_ACCEPT_FIRST_CLICK, 0),
|
: BWindow(frame, "VolumeSlider", B_BORDERED_WINDOW_LOOK, B_FLOATING_ALL_WINDOW_FEEL,
|
||||||
aOutNode(NULL),
|
B_ASYNCHRONOUS_CONTROLS | B_WILL_ACCEPT_FIRST_CLICK, 0),
|
||||||
paramWeb(NULL),
|
fAudioMixerNode(NULL),
|
||||||
mixerParam(NULL)
|
fParamWeb(NULL),
|
||||||
|
fMixerParam(NULL)
|
||||||
{
|
{
|
||||||
// Make sure it's not outside the screen.
|
// Make sure it's not outside the screen.
|
||||||
const int32 kMargin = 3;
|
const int32 kMargin = 3;
|
||||||
@@ -51,9 +48,9 @@ VolumeSlider::VolumeSlider(BRect frame, bool dontBeep, int32 volumeWhich)
|
|||||||
|
|
||||||
float value = 0.0;
|
float value = 0.0;
|
||||||
bool retrying = false;
|
bool retrying = false;
|
||||||
this->dontBeep = dontBeep;
|
fDontBeep = dontBeep;
|
||||||
|
|
||||||
aOutNode = new media_node();
|
fAudioMixerNode = new media_node();
|
||||||
|
|
||||||
status_t err = B_OK; /* BMediaRoster::Roster() doesn't set it if all is ok */
|
status_t err = B_OK; /* BMediaRoster::Roster() doesn't set it if all is ok */
|
||||||
const char *errString = NULL;
|
const char *errString = NULL;
|
||||||
@@ -76,24 +73,23 @@ VolumeSlider::VolumeSlider(BRect frame, bool dontBeep, int32 volumeWhich)
|
|||||||
roster = BMediaRoster::Roster(&err);
|
roster = BMediaRoster::Roster(&err);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (roster && (err==B_OK)) {
|
if (roster && err == B_OK) {
|
||||||
switch (volumeWhich) {
|
switch (volumeWhich) {
|
||||||
case VOLUME_USE_MIXER:
|
case VOLUME_USE_MIXER:
|
||||||
err = roster->GetAudioMixer(aOutNode);
|
err = roster->GetAudioMixer(fAudioMixerNode);
|
||||||
break;
|
break;
|
||||||
case VOLUME_USE_PHYS_OUTPUT:
|
case VOLUME_USE_PHYS_OUTPUT:
|
||||||
err = roster->GetAudioOutput(aOutNode);
|
err = roster->GetAudioOutput(fAudioMixerNode);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (err == B_OK) {
|
if (err == B_OK) {
|
||||||
if((err = roster->GetParameterWebFor(*aOutNode, ¶mWeb)) == B_OK) {
|
if ((err = roster->GetParameterWebFor(*fAudioMixerNode, &fParamWeb)) == B_OK) {
|
||||||
|
|
||||||
// Finding the Mixer slider in the audio output ParameterWeb
|
// Finding the Mixer slider in the audio output ParameterWeb
|
||||||
int32 numParams = paramWeb->CountParameters();
|
int32 numParams = fParamWeb->CountParameters();
|
||||||
BParameter* p = NULL;
|
BParameter* p = NULL;
|
||||||
bool foundMixerLabel = false;
|
bool foundMixerLabel = false;
|
||||||
for (int i = 0; i < numParams; i++) {
|
for (int i = 0; i < numParams; i++) {
|
||||||
p = paramWeb->ParameterAt(i);
|
p = fParamWeb->ParameterAt(i);
|
||||||
PRINT(("BParameter[%i]: %s\n", i, p->Name()));
|
PRINT(("BParameter[%i]: %s\n", i, p->Name()));
|
||||||
if (volumeWhich == VOLUME_USE_MIXER) {
|
if (volumeWhich == VOLUME_USE_MIXER) {
|
||||||
if (!strcmp(p->Kind(), B_MASTER_GAIN))
|
if (!strcmp(p->Kind(), B_MASTER_GAIN))
|
||||||
@@ -125,7 +121,7 @@ VolumeSlider::VolumeSlider(BRect frame, bool dontBeep, int32 volumeWhich)
|
|||||||
//if (!strcmp(p->Name(), "Master")) {
|
//if (!strcmp(p->Name(), "Master")) {
|
||||||
if (!strcmp(p->Kind(), B_MASTER_GAIN)) {
|
if (!strcmp(p->Kind(), B_MASTER_GAIN)) {
|
||||||
for (; i < numParams; i++) {
|
for (; i < numParams; i++) {
|
||||||
p = paramWeb->ParameterAt(i);
|
p = fParamWeb->ParameterAt(i);
|
||||||
if (strcmp(p->Kind(), B_MASTER_GAIN)) p=NULL;
|
if (strcmp(p->Kind(), B_MASTER_GAIN)) p=NULL;
|
||||||
else break;
|
else break;
|
||||||
}
|
}
|
||||||
@@ -135,23 +131,24 @@ VolumeSlider::VolumeSlider(BRect frame, bool dontBeep, int32 volumeWhich)
|
|||||||
p = NULL;
|
p = NULL;
|
||||||
}
|
}
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
errString = volumeWhich?"Could not find the soundcard":"Could not find the mixer";
|
errString = volumeWhich
|
||||||
|
? "Could not find the soundcard":"Could not find the mixer";
|
||||||
} else if (p->Type() != BParameter::B_CONTINUOUS_PARAMETER) {
|
} else if (p->Type() != BParameter::B_CONTINUOUS_PARAMETER) {
|
||||||
errString = volumeWhich?"Soundcard control unknown":"Mixer control unknown";
|
errString = volumeWhich
|
||||||
|
? "Soundcard control unknown":"Mixer control unknown";
|
||||||
} else {
|
} else {
|
||||||
|
fMixerParam = dynamic_cast<BContinuousParameter*>(p);
|
||||||
mixerParam = dynamic_cast<BContinuousParameter*>(p);
|
fMin = fMixerParam->MinValue();
|
||||||
min = mixerParam->MinValue();
|
fMax = fMixerParam->MaxValue();
|
||||||
max = mixerParam->MaxValue();
|
fStep = fMixerParam->ValueStep();
|
||||||
step = mixerParam->ValueStep();
|
|
||||||
|
|
||||||
float chanData[2];
|
float chanData[2];
|
||||||
bigtime_t lastChange;
|
bigtime_t lastChange;
|
||||||
size_t size = sizeof(chanData);
|
size_t size = sizeof(chanData);
|
||||||
|
|
||||||
mixerParam->GetValue( &chanData, &size, &lastChange );
|
fMixerParam->GetValue(&chanData, &size, &lastChange);
|
||||||
|
|
||||||
value = (chanData[0]-min)*100/((max-min)?(max-min):1);
|
value = (chanData[0] - fMin) * 100 / ((fMax - fMin) ? (fMax - fMin) : 1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
errString = "No parameter web";
|
errString = "No parameter web";
|
||||||
@@ -172,23 +169,24 @@ VolumeSlider::VolumeSlider(BRect frame, bool dontBeep, int32 volumeWhich)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (err != B_OK) {
|
if (err != B_OK) {
|
||||||
delete aOutNode;
|
delete fAudioMixerNode;
|
||||||
aOutNode = NULL;
|
fAudioMixerNode = NULL;
|
||||||
}
|
}
|
||||||
if (errString)
|
if (errString)
|
||||||
fprintf(stderr, "VolumeSlider: %s.\n", errString);
|
fprintf(stderr, "VolumeSlider: %s.\n", errString);
|
||||||
|
|
||||||
BBox *box = new BBox(Bounds(), "sliderbox", B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_FRAME_EVENTS, B_PLAIN_BORDER);
|
BBox *box = new BBox(Bounds(), "sliderbox", B_FOLLOW_LEFT | B_FOLLOW_TOP,
|
||||||
|
B_WILL_DRAW | B_FRAME_EVENTS, B_PLAIN_BORDER);
|
||||||
AddChild(box);
|
AddChild(box);
|
||||||
|
|
||||||
hasChanged = false; /* make sure we don't beep if we don't change anything */
|
fHasChanged = false; /* make sure we don't beep if we don't change anything */
|
||||||
if (mixerParam == NULL)
|
if (fMixerParam == NULL)
|
||||||
value = -1;
|
value = -1;
|
||||||
slider = new SliderView(box->Bounds().InsetByCopy(1, 1), new BMessage(VOLUME_CHANGED),
|
fSlider = new SliderView(box->Bounds().InsetByCopy(1, 1), new BMessage(VOLUME_CHANGED),
|
||||||
(errString==NULL) ? "Volume" : errString, B_FOLLOW_LEFT | B_FOLLOW_TOP, value);
|
errString == NULL ? "Volume" : errString, B_FOLLOW_LEFT | B_FOLLOW_TOP, value);
|
||||||
box->AddChild(slider);
|
box->AddChild(fSlider);
|
||||||
|
|
||||||
slider->SetTarget(this);
|
fSlider->SetTarget(this);
|
||||||
|
|
||||||
SetPulseRate(100);
|
SetPulseRate(100);
|
||||||
}
|
}
|
||||||
@@ -196,10 +194,10 @@ VolumeSlider::VolumeSlider(BRect frame, bool dontBeep, int32 volumeWhich)
|
|||||||
|
|
||||||
VolumeSlider::~VolumeSlider()
|
VolumeSlider::~VolumeSlider()
|
||||||
{
|
{
|
||||||
delete paramWeb;
|
delete fParamWeb;
|
||||||
BMediaRoster* roster = BMediaRoster::CurrentRoster();
|
BMediaRoster* roster = BMediaRoster::CurrentRoster();
|
||||||
if(roster && aOutNode)
|
if (roster && fAudioMixerNode)
|
||||||
roster->ReleaseNode(*aOutNode);
|
roster->ReleaseNode(*fAudioMixerNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -209,70 +207,77 @@ VolumeSlider::WindowActivated(bool active)
|
|||||||
/* don't Quit() ! thanks for FFM users */
|
/* don't Quit() ! thanks for FFM users */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
VolumeSlider::MessageReceived(BMessage *msg)
|
VolumeSlider::MessageReceived(BMessage *msg)
|
||||||
{
|
{
|
||||||
switch (msg->what) {
|
switch (msg->what) {
|
||||||
case VOLUME_UPDATED:
|
case VOLUME_UPDATED:
|
||||||
PRINT(("VOLUME_UPDATED\n"));
|
PRINT(("VOLUME_UPDATED\n"));
|
||||||
UpdateVolume(mixerParam);
|
UpdateVolume(fMixerParam);
|
||||||
hasChanged = true;
|
fHasChanged = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VOLUME_CHANGED:
|
case VOLUME_CHANGED:
|
||||||
if (hasChanged) {
|
if (fHasChanged) {
|
||||||
PRINT(("VOLUME_CHANGED\n"));
|
PRINT(("VOLUME_CHANGED\n"));
|
||||||
UpdateVolume(mixerParam);
|
UpdateVolume(fMixerParam);
|
||||||
if (!dontBeep)
|
if (!fDontBeep)
|
||||||
beep();
|
beep();
|
||||||
}
|
}
|
||||||
Quit();
|
Quit();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
BWindow::MessageReceived(msg); // not a slider message, not our problem
|
BWindow::MessageReceived(msg); // not a slider message, not our problem
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void VolumeSlider::UpdateVolume(BContinuousParameter* param)
|
|
||||||
|
void
|
||||||
|
VolumeSlider::UpdateVolume(BContinuousParameter* param)
|
||||||
{
|
{
|
||||||
if (!param)
|
if (!param)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
float chanData[2];
|
float chanData[2];
|
||||||
bigtime_t lastChange;
|
bigtime_t lastChange;
|
||||||
size_t size = sizeof(chanData);
|
size_t size = sizeof(chanData);
|
||||||
|
|
||||||
mixerParam->GetValue( &chanData, &size, &lastChange );
|
fMixerParam->GetValue( &chanData, &size, &lastChange );
|
||||||
|
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
chanData[i] = (slider->Value() * (max - min) / 100) / step * step + min;
|
chanData[i] = (fSlider->Value() * (fMax - fMin) / 100) / fStep * fStep + fMin;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRINT(("Min value: %f Max Value: %f\nData: %f %f\n", mixerParam->MinValue(), mixerParam->MaxValue(), chanData[0], chanData[1]));
|
PRINT(("Min value: %f Max Value: %f\nData: %f %f\n",
|
||||||
mixerParam->SetValue(&chanData, sizeof(chanData), system_time()+1000);
|
fMixerParam->MinValue(), fMixerParam->MaxValue(), chanData[0], chanData[1]));
|
||||||
|
fMixerParam->SetValue(&chanData, sizeof(chanData), system_time()+1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define REDZONESTART 151
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
SliderView::SliderView(BRect rect, BMessage *msg, const char *title, uint32 resizeFlags, int32 value)
|
SliderView::SliderView(BRect rect, BMessage *msg, const char *title,
|
||||||
|
uint32 resizeFlags, int32 value)
|
||||||
: BControl(rect, "slider", NULL, msg, resizeFlags, B_WILL_DRAW | B_PULSE_NEEDED),
|
: BControl(rect, "slider", NULL, msg, resizeFlags, B_WILL_DRAW | B_PULSE_NEEDED),
|
||||||
leftBitmap(BRect(0, 0, kLeftWidth - 1, kLeftHeight - 1), B_CMAP8),
|
fLeftBitmap(BRect(0, 0, kLeftWidth - 1, kLeftHeight - 1), B_CMAP8),
|
||||||
rightBitmap(BRect(0, 0, kRightWidth - 1, kRightHeight - 1), B_CMAP8),
|
fRightBitmap(BRect(0, 0, kRightWidth - 1, kRightHeight - 1), B_CMAP8),
|
||||||
buttonBitmap(BRect(0, 0, kButtonWidth - 1, kButtonHeight - 1), B_CMAP8),
|
fButtonBitmap(BRect(0, 0, kButtonWidth - 1, kButtonHeight - 1), B_CMAP8),
|
||||||
fTitle(title)
|
fTitle(title)
|
||||||
{
|
{
|
||||||
leftBitmap.SetBits(kLeftBits, kLeftWidth * kLeftHeight, 0, B_CMAP8);
|
fLeftBitmap.SetBits(kLeftBits, kLeftWidth * kLeftHeight, 0, B_CMAP8);
|
||||||
rightBitmap.SetBits(kRightBits, kRightWidth * kRightHeight, 0, B_CMAP8);
|
fRightBitmap.SetBits(kRightBits, kRightWidth * kRightHeight, 0, B_CMAP8);
|
||||||
buttonBitmap.SetBits(kButtonBits, kButtonWidth * kButtonHeight, 0, B_CMAP8);
|
fButtonBitmap.SetBits(kButtonBits, kButtonWidth * kButtonHeight, 0, B_CMAP8);
|
||||||
|
|
||||||
SetTracking(true);
|
SetTracking(true);
|
||||||
SetMouseEventMask(B_POINTER_EVENTS, B_LOCK_WINDOW_FOCUS);
|
|
||||||
SetValue(value);
|
SetValue(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SliderView::~SliderView()
|
SliderView::~SliderView()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -306,8 +311,8 @@ SliderView::Draw(BRect updateRect)
|
|||||||
|
|
||||||
SetDrawingMode(B_OP_OVER);
|
SetDrawingMode(B_OP_OVER);
|
||||||
|
|
||||||
DrawBitmapAsync(&leftBitmap, BPoint(5,1));
|
DrawBitmapAsync(&fLeftBitmap, BPoint(5,1));
|
||||||
DrawBitmapAsync(&rightBitmap, BPoint(193,1));
|
DrawBitmapAsync(&fRightBitmap, BPoint(193,1));
|
||||||
|
|
||||||
float position = 11 + (192-11) * ((Value() == -1) ? 0 : Value()) / 100;
|
float position = 11 + (192-11) * ((Value() == -1) ? 0 : Value()) / 100;
|
||||||
float right = (position < REDZONESTART) ? position : REDZONESTART;
|
float right = (position < REDZONESTART) ? position : REDZONESTART;
|
||||||
@@ -330,7 +335,7 @@ SliderView::Draw(BRect updateRect)
|
|||||||
SetHighColor(49,154,49);
|
SetHighColor(49,154,49);
|
||||||
DrawString(fTitle, BPoint(11 + (192-11-width)/2, 12));
|
DrawString(fTitle, BPoint(11 + (192-11-width)/2, 12));
|
||||||
|
|
||||||
DrawBitmapAsync(&buttonBitmap, BPoint(position-5,3));
|
DrawBitmapAsync(&fButtonBitmap, BPoint(position-5,3));
|
||||||
|
|
||||||
Sync();
|
Sync();
|
||||||
|
|
||||||
@@ -354,7 +359,7 @@ SliderView::MouseMoved(BPoint point, uint32 transit, const BMessage *message)
|
|||||||
SetTracking(false);
|
SetTracking(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((Value() == -1) || !Bounds().InsetBySelf(2,2).Contains(point))
|
if (Value() == -1 || !Bounds().InsetBySelf(2, 2).Contains(point))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
float v = MIN(MAX(point.x, 11), 192);
|
float v = MIN(MAX(point.x, 11), 192);
|
||||||
@@ -363,6 +368,7 @@ SliderView::MouseMoved(BPoint point, uint32 transit, const BMessage *message)
|
|||||||
SetValue(v);
|
SetValue(v);
|
||||||
Draw(Bounds());
|
Draw(Bounds());
|
||||||
Flush();
|
Flush();
|
||||||
|
|
||||||
if (Window())
|
if (Window())
|
||||||
Window()->PostMessage(VOLUME_UPDATED);
|
Window()->PostMessage(VOLUME_UPDATED);
|
||||||
}
|
}
|
||||||
@@ -373,7 +379,8 @@ SliderView::MouseUp(BPoint point)
|
|||||||
{
|
{
|
||||||
if (!IsTracking())
|
if (!IsTracking())
|
||||||
return;
|
return;
|
||||||
if ((Value() != -1) && Bounds().InsetBySelf(2,2).Contains(point)) {
|
|
||||||
|
if (Value() != -1 && Bounds().InsetBySelf(2, 2).Contains(point)) {
|
||||||
float v = MIN(MAX(point.x, 11), 192);
|
float v = MIN(MAX(point.x, 11), 192);
|
||||||
v = (v - 11) / (192-11) * 100;
|
v = (v - 11) / (192-11) * 100;
|
||||||
v = MAX(MIN(v,100), 0);
|
v = MAX(MIN(v,100), 0);
|
||||||
|
|||||||
@@ -1,19 +1,11 @@
|
|||||||
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
|
/*
|
||||||
//
|
* Copyright (c) 2003-2005, Haiku, Inc.
|
||||||
// Copyright (c) 2003, OpenBeOS
|
* Distributed under the terms of the MIT license.
|
||||||
//
|
*
|
||||||
// This software is part of the OpenBeOS distribution and is covered
|
* Authors:
|
||||||
// by the OpenBeOS license.
|
* Jérôme Duval
|
||||||
//
|
* François Revol
|
||||||
//
|
*/
|
||||||
// Program: desklink
|
|
||||||
// Author: Jérôme DUVAL
|
|
||||||
// Description: VolumeControl and link items in Deskbar
|
|
||||||
// Created : October 20, 2003
|
|
||||||
// Modified by: Jérome Duval
|
|
||||||
// Modified by: François Revol, 10/31/2003
|
|
||||||
//
|
|
||||||
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
|
|
||||||
#ifndef VOLUMESLIDER_H
|
#ifndef VOLUMESLIDER_H
|
||||||
#define VOLUMESLIDER_H
|
#define VOLUMESLIDER_H
|
||||||
|
|
||||||
@@ -25,37 +17,41 @@
|
|||||||
#define VOLUME_USE_MIXER 0 /* default */
|
#define VOLUME_USE_MIXER 0 /* default */
|
||||||
#define VOLUME_USE_PHYS_OUTPUT 1
|
#define VOLUME_USE_PHYS_OUTPUT 1
|
||||||
|
|
||||||
class SliderView : public BControl
|
|
||||||
{
|
class SliderView : public BControl {
|
||||||
public:
|
public:
|
||||||
SliderView(BRect rect, BMessage *msg, const char* title, uint32 resizeFlags, int32 value);
|
SliderView(BRect rect, BMessage *msg, const char* title, uint32 resizeFlags,
|
||||||
|
int32 value);
|
||||||
~SliderView();
|
~SliderView();
|
||||||
|
|
||||||
virtual void Draw(BRect);
|
virtual void Draw(BRect);
|
||||||
virtual void MouseMoved(BPoint point, uint32 transit, const BMessage *message);
|
virtual void MouseMoved(BPoint point, uint32 transit, const BMessage *message);
|
||||||
virtual void MouseUp(BPoint point);
|
virtual void MouseUp(BPoint point);
|
||||||
virtual void Pulse();
|
virtual void Pulse();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BBitmap leftBitmap, rightBitmap, buttonBitmap;
|
BBitmap fLeftBitmap, fRightBitmap, fButtonBitmap;
|
||||||
const char* fTitle;
|
const char* fTitle;
|
||||||
};
|
};
|
||||||
|
|
||||||
class VolumeSlider : public BWindow
|
class VolumeSlider : public BWindow {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
VolumeSlider(BRect frame, bool dontBeep=false, int32 volumeWhich=0);
|
VolumeSlider(BRect frame, bool dontBeep=false, int32 volumeWhich=0);
|
||||||
~VolumeSlider();
|
~VolumeSlider();
|
||||||
|
|
||||||
void MessageReceived(BMessage*);
|
void MessageReceived(BMessage*);
|
||||||
void WindowActivated(bool active);
|
void WindowActivated(bool active);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void UpdateVolume(BContinuousParameter* param);
|
void UpdateVolume(BContinuousParameter* param);
|
||||||
media_node *aOutNode;
|
|
||||||
BParameterWeb* paramWeb;
|
media_node *fAudioMixerNode;
|
||||||
BContinuousParameter* mixerParam;
|
BParameterWeb* fParamWeb;
|
||||||
float min, max, step;
|
BContinuousParameter* fMixerParam;
|
||||||
bool hasChanged;
|
float fMin, fMax, fStep;
|
||||||
bool dontBeep;
|
bool fHasChanged;
|
||||||
SliderView *slider;
|
bool fDontBeep;
|
||||||
|
SliderView *fSlider;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif // VOLUMESLIDER_H
|
||||||
|
|||||||
Reference in New Issue
Block a user