~ubuntu-branches/ubuntu/natty/ecasound2.2/natty

« back to all changes in this revision

Viewing changes to libecasound/audioio-ewf.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Junichi Uekawa
  • Date: 2007-02-04 11:32:59 UTC
  • mfrom: (2.1.7 feisty)
  • Revision ID: james.westby@ubuntu.com-20070204113259-uthtjkh4t90fyukk
Tags: 2.4.4-6
Bug fix: "libecasound2.2-dev: missing dependency on libasound2-dev",
thanks to Steve Langasek (Closes: #409438).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
// ------------------------------------------------------------------------
2
2
// audioio-ewf.cpp: Ecasound wave format input/output
3
 
// Copyright (C) 1999-2002 Kai Vehmanen
 
3
// Copyright (C) 1999-2002,2005 Kai Vehmanen
 
4
//
 
5
// Attributes:
 
6
//     eca-style-version: 3
4
7
//
5
8
// This program is free software; you can redistribute it and/or modify
6
9
// it under the terms of the GNU General Public License as published by
34
37
#include "eca-error.h"
35
38
#include "eca-logger.h"
36
39
 
37
 
using std::cerr;
 
40
using std::cout;
38
41
using std::endl;
39
42
 
40
43
EWFFILE::EWFFILE (const std::string& name)
52
55
  for(int n = 0; n < number_of_params(); n++) {
53
56
    target->set_parameter(n + 1, get_parameter(n + 1));
54
57
  }
55
 
  return(target);
 
58
  return target;
56
59
}
57
60
 
58
61
void EWFFILE::open(void) throw(AUDIO_IO::SETUP_ERROR &)
123
126
   *       position_in_samples value
124
127
   */
125
128
 
 
129
  //dump_child_debug();
 
130
 
126
131
  if (child_active != true) {
127
132
    // ---
128
133
    // child not active
203
208
 
204
209
        child()->set_buffersize(save_bsize);
205
210
        sbuf->length_in_samples(buffersize());
 
211
        DBC_CHECK(sbuf->length_in_samples() - tail < sbuf->length_in_samples());
206
212
        sbuf->copy_range(tmp_buffer, 
207
213
                         0,
208
214
                         tmp_buffer.length_in_samples(), 
237
243
 
238
244
void EWFFILE::dump_child_debug(void)
239
245
{
240
 
  cerr << "Global position (in samples): " << position_in_samples() << endl;
241
 
  cerr << "child-pos: " << child()->position_in_samples() << endl;
242
 
  cerr << "child-offset: " << child_offset_rep.samples() << endl;
243
 
  cerr << "child-startpos: " << child_start_pos_rep.samples() << endl;
244
 
  cerr << "child-length: " << child_length_rep.samples() << endl;
 
246
  cout << "Global position (in samples): " << position_in_samples() << endl;
 
247
  cout << "child-pos: " << child()->position_in_samples() << endl;
 
248
  cout << "child-offset: " << child_offset_rep.samples() << endl;
 
249
  cout << "child-startpos: " << child_start_pos_rep.samples() << endl;
 
250
  cout << "child-length: " << child_length_rep.samples() << endl;
 
251
  cout << "child-active: " << (int)child_active << endl;
245
252
}
246
253
 
247
254
void EWFFILE::write_buffer(SAMPLE_BUFFER* sbuf)
332
339
  if (io_mode() != AUDIO_IO::io_read) ewf_rc.save();
333
340
}
334
341
 
335
 
void EWFFILE::child_offset(const ECA_AUDIO_TIME& v) { child_offset_rep = v; }
336
 
void EWFFILE::child_start_position(const ECA_AUDIO_TIME& v) { child_start_pos_rep = v; }
337
 
void EWFFILE::child_length(const ECA_AUDIO_TIME& v) { child_length_rep = v; }
 
342
void EWFFILE::child_offset(const ECA_AUDIO_TIME& v)
 
343
{
 
344
  child_offset_rep = v;
 
345
}
 
346
 
 
347
void EWFFILE::child_start_position(const ECA_AUDIO_TIME& v)
 
348
{
 
349
  child_start_pos_rep = v;
 
350
}
 
351
 
 
352
void EWFFILE::child_length(const ECA_AUDIO_TIME& v) {
 
353
  child_length_rep = v;
 
354
}
338
355
 
339
356
bool EWFFILE::finished(void) const
340
357
{
346
363
      (child_looping_rep != true &&
347
364
       child_length_rep.samples() != 0 &&
348
365
       position_in_samples() > child_offset_rep.samples() + child_length_rep.samples()))
349
 
    return(true);
350
 
  return(false);
 
366
    return true;
 
367
  return false;
351
368
}