~ubuntu-branches/ubuntu/feisty/avidemux/feisty

« back to all changes in this revision

Viewing changes to avidemux/ADM_audiodevice/ADM_deviceoss.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Daniel T Chen
  • Date: 2006-12-15 17:13:20 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20061215171320-w79pvpehxx2fr217
Tags: 1:2.3.0-0.0ubuntu1
* Merge from debian-multimedia.org, remaining Ubuntu change:
  - desktop file,
  - no support for ccache and make -j.
* Closes Ubuntu: #69614.

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
 
41
41
 
42
42
#include "ADM_library/default.h"
43
 
#include "audio_out.h"
 
43
#include "ADM_audiodevice.h"
44
44
#include <ADM_assert.h>
45
45
#include  "ADM_audiodevice/ADM_deviceoss.h"
46
46
#include "ADM_toolkit/toolkit.hxx"
54
54
{
55
55
        int fd;
56
56
        int ret;
57
 
        uint8_t which_vol = 0;
 
57
        uint32_t which_vol = 0;
58
58
 
59
59
        prefs->get(FEATURE_AUDIOBAR_USES_MASTER,&which_vol);
60
60
        fd=open(device_mixer,O_RDONLY);
100
100
//
101
101
//
102
102
//_______________________________________________
103
 
uint8_t ossAudioDevice::init(uint32_t channel, uint32_t fq) 
 
103
uint8_t ossAudioDevice::init(uint8_t channels, uint32_t fq) 
104
104
{
105
 
        
106
 
    printf("\n OSS  : %lu Hz, %lu channels", fq, channel);
 
105
        _channels = channels;
 
106
 
 
107
    printf("\n OSS  : %lu Hz, %lu channels", fq, channels);
107
108
    // open OSS device
108
109
    oss_fd = open(dsp, O_WRONLY | O_NONBLOCK);
109
110
    if (oss_fd == -1) {
110
111
        if( errno == EACCES )
111
112
        {
112
 
           GUI_Error_HIG("Could not open OSS audio device", "Check the permissions for /dev/dsp.");
 
113
          GUI_Error_HIG(_("Could not open OSS audio device"), _("Check the permissions for /dev/dsp."));
113
114
          }
114
115
        else
115
116
           printf("\n Error initializing OSS: Error : %d", errno);
120
121
        printf("\n Error setting up OSS(SPEED): Error : %d", errno);
121
122
        return 0;
122
123
    }
123
 
    if (channel > 2) {
124
 
        if (ioctl (oss_fd, SNDCTL_DSP_CHANNELS, &channel) < 0) {
 
124
    if (channels > 2) {
 
125
        if (ioctl (oss_fd, SNDCTL_DSP_CHANNELS, &channels) < 0) {
125
126
            printf("\n Error setting up OSS(CHANNELS): Error : %d", errno);
126
127
            return 0;
127
128
        }
128
129
    } else {
129
 
        int chan = channel - 1;
 
130
        int chan = channels - 1;
130
131
        if (ioctl (oss_fd, SNDCTL_DSP_STEREO, &chan) < 0) {
131
132
            printf("\n Error setting up OSS(STEREO): Error : %d", errno);
132
133
            return 0;
149
150
//
150
151
//
151
152
//_______________________________________________
152
 
uint8_t ossAudioDevice::play(uint32_t nb,uint8_t * ptr)
153
 
 {
154
 
    uint32_t w;
155
 
 
156
 
    if (!oss_fd)
157
 
        return 0;
158
 
    w = write(oss_fd, ptr, nb);
159
 
 
160
 
    return 1;
 
153
uint8_t ossAudioDevice::play(uint32_t len, float *data)
 
154
{
 
155
        uint32_t w;
 
156
 
 
157
        if (!oss_fd)
 
158
                return 0;
 
159
 
 
160
        dither16(data, len, _channels);
 
161
 
 
162
        w = write(oss_fd, data, len*2);
 
163
        if(w!=len*2)
 
164
        {
 
165
          printf("[OSS] Warning : %u / %u\n",w,len*2); 
 
166
        }
 
167
        return 1;
161
168
}
162
169
#else
163
170
void dummy_oss_func( void);