comparison audioio/ClipMixer.cpp @ 308:289d65722123 tonioni

More work on mixing and file i/o for sample stuff
author Chris Cannam
date Tue, 07 Jan 2014 15:50:04 +0000
parents 6eb15c3aee0a
children 8c59cc68eabd
comparison
equal deleted inserted replaced
307:6eb15c3aee0a 308:289d65722123
30 ClipMixer::~ClipMixer() 30 ClipMixer::~ClipMixer()
31 { 31 {
32 delete[] m_clipData; 32 delete[] m_clipData;
33 } 33 }
34 34
35 void
36 ClipMixer::setChannelCount(int channels)
37 {
38 m_channels = channels;
39 }
40
35 bool 41 bool
36 ClipMixer::loadClipData(QString path, float f0) 42 ClipMixer::loadClipData(QString path, float f0)
37 { 43 {
38 if (m_clipData) { 44 if (m_clipData) {
39 cerr << "ClipMixer::loadClipData: Already have clip loaded" << endl; 45 cerr << "ClipMixer::loadClipData: Already have clip loaded" << endl;
47 size_t i; 53 size_t i;
48 54
49 info.format = 0; 55 info.format = 0;
50 file = sf_open(path.toLocal8Bit().data(), SFM_READ, &info); 56 file = sf_open(path.toLocal8Bit().data(), SFM_READ, &info);
51 if (!file) { 57 if (!file) {
52 cerr << "ClipMixer::loadClipData: Failed to open file " 58 cerr << "ClipMixer::loadClipData: Failed to open file path \""
53 << path << ": " << sf_strerror(file) << endl; 59 << path << "\": " << sf_strerror(file) << endl;
54 return false; 60 return false;
55 } 61 }
56 62
57 tmpFrames = (float *)malloc(info.frames * info.channels * sizeof(float)); 63 tmpFrames = (float *)malloc(info.frames * info.channels * sizeof(float));
58 if (!tmpFrames) { 64 if (!tmpFrames) {
84 m_clipF0 = f0; 90 m_clipF0 = f0;
85 m_clipRate = info.samplerate; 91 m_clipRate = info.samplerate;
86 } 92 }
87 93
88 void 94 void
95 ClipMixer::reset()
96 {
97 //!!!
98 }
99
100 void
89 ClipMixer::mix(float **toBuffers, 101 ClipMixer::mix(float **toBuffers,
102 float gain,
90 std::vector<NoteStart> newNotes, 103 std::vector<NoteStart> newNotes,
91 std::vector<NoteEnd> endingNotes) 104 std::vector<NoteEnd> endingNotes)
92 { 105 {
93 //!!! do this! 106 //!!! do this!
94 } 107 }