~ubuntu-branches/ubuntu/natty/kdemultimedia/natty-proposed

« back to all changes in this revision

Viewing changes to kmix/backends/mixer_irix.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Debian Qt/KDE Maintainers
  • Date: 2011-05-26 02:41:36 UTC
  • mfrom: (0.2.3 upstream)
  • mto: This revision was merged to the branch mainline in revision 108.
  • Revision ID: james.westby@ubuntu.com-20110526024136-jjwsigfy402jhupm
Tags: upstream-4.6.3
ImportĀ upstreamĀ versionĀ 4.6.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *              KMix -- KDE's full featured mini mixer
 
3
 *
 
4
 *
 
5
 *              Copyright (C) 1996-2000 Christian Esken
 
6
 *                        esken@kde.org
 
7
 *
 
8
 * This program is free software; you can redistribute it and/or
 
9
 * modify it under the terms of the GNU Library General Public
 
10
 * License as published by the Free Software Foundation; either
 
11
 * version 2 of the License, or (at your option) any later version.
 
12
 *
 
13
 * This program is distributed in the hope that it will be useful,
 
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
16
 * Library General Public License for more details.
 
17
 *
 
18
 * You should have received a copy of the GNU Library General Public
 
19
 * License along with this program; if not, write to the Free
 
20
 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
21
 */
 
22
 
 
23
#include "mixer_irix.h"
 
24
 
 
25
#error "The IRIX port is not maintained anymore, an no official part of KMix / KDE at this point of time! Please contact the current KMix maintainer if you would like to maintain the port."
 
26
 
 
27
Mixer_Backend* IRIX_getMixer(int devnum)
 
28
{
 
29
  Mixer_Backend *l_mixer;
 
30
  l_mixer = new Mixer_IRIX( devnum);
 
31
  l_mixer->init(devnum);
 
32
  return l_mixer;
 
33
}
 
34
 
 
35
 
 
36
 
 
37
Mixer_IRIX::Mixer_IRIX(int devnum) : Mixer_Backend(devnum)
 
38
{
 
39
  close();
 
40
}
 
41
 
 
42
int Mixer_IRIX::open()
 
43
{
 
44
  // Create config
 
45
  m_config = ALnewconfig();
 
46
  if (m_config == (ALconfig)0) {
 
47
    cerr << "OpenAudioDevice(): ALnewconfig() failed\n";
 
48
    return Mixer::ERR_OPEN;
 
49
  }
 
50
  // Open audio device
 
51
  m_port = ALopenport("XVDOPlayer", "w", m_config);
 
52
  if (m_port == (ALport)0) {
 
53
    return Mixer::ERR_OPEN;
 
54
  }
 
55
  else {
 
56
    // Mixer is open. Now define properties
 
57
    devmask     = 1+128+2048;
 
58
    recmask     = 128;
 
59
    i_recsrc    = 128;
 
60
    stereodevs  = 1+128+2048;
 
61
    MaxVolume   = 255;
 
62
 
 
63
    i_s_mixer_name = "HPUX Audio Mixer";
 
64
 
 
65
    isOpen      = true;
 
66
    return 0;
 
67
  }
 
68
}
 
69
 
 
70
int Mixer_IRIX::close()
 
71
{
 
72
  _pollingTimer->stop();
 
73
  m_isOpen = false;
 
74
  ALfreeconfig(m_config);
 
75
  ALcloseport(m_port);
 
76
  m_mixDevices.clear();
 
77
  return 0;
 
78
}
 
79
 
 
80
int Mixer_IRIX::readVolumeFromHW( int devnumi, Volume &vol, Volume & )
 
81
{
 
82
  long in_buf[4];
 
83
  switch( devnum() ) {
 
84
  case 0:       // Speaker Output
 
85
    in_buf[0] = AL_RIGHT_SPEAKER_GAIN;
 
86
    in_buf[2] = AL_LEFT_SPEAKER_GAIN;
 
87
    break;
 
88
  case 7:       // Microphone Input (actually selectable).
 
89
    in_buf[0] = AL_RIGHT_INPUT_ATTEN;
 
90
    in_buf[2] = AL_LEFT_INPUT_ATTEN;
 
91
    break;
 
92
  case 11:      // Record monitor
 
93
    in_buf[0] = AL_RIGHT_MONITOR_ATTEN;
 
94
    in_buf[2] = AL_LEFT_MONITOR_ATTEN;
 
95
    break;
 
96
  default:
 
97
    printf("Unknown device %d\n", MixPtr->num() );
 
98
  }
 
99
  ALgetparams(AL_DEFAULT_DEVICE, in_buf, 4);
 
100
  *VolRight = in_buf[1]*100/255;
 
101
  *VolLeft  = in_buf[3]*100/255;
 
102
 
 
103
  return 0;
 
104
}
 
105
 
 
106
int Mixer_IRIX::writeVolumeToHW( int devnum, Volume &vol, Volume & )
 
107
{
 
108
  // Set volume (right&left)
 
109
  long out_buf[4] =
 
110
  {
 
111
    0, volRight,
 
112
    0, volLeft
 
113
  };
 
114
  switch( mixdevice->num() ) {
 
115
  case 0:      // Speaker
 
116
    out_buf[0] = AL_RIGHT_SPEAKER_GAIN;
 
117
    out_buf[2] = AL_LEFT_SPEAKER_GAIN;
 
118
    break;
 
119
  case 7:      // Microphone (Input)
 
120
    out_buf[0] = AL_RIGHT_INPUT_ATTEN;
 
121
    out_buf[2] = AL_LEFT_INPUT_ATTEN;
 
122
    break;
 
123
  case 11:     // Record monitor
 
124
    out_buf[0] = AL_RIGHT_MONITOR_ATTEN;
 
125
    out_buf[2] = AL_LEFT_MONITOR_ATTEN;
 
126
    break;
 
127
  }
 
128
  ALsetparams(AL_DEFAULT_DEVICE, out_buf, 4);
 
129
 
 
130
  return 0;
 
131
}
 
132
 
 
133
QString IRIX_getDriverName() {
 
134
        return "IRIX";
 
135
}
 
136
 
 
137
QString Mixer_IRIX::getDriverName()
 
138
{
 
139
        return "IRIX";
 
140
}
 
141