BTRFS: Implement BTree::Path and change _Find.
[haiku.git] / src / apps / midiplayer / SynthBridge.cpp
blob91dff66c93be06fedb112d10298a59f7161e1111
1 /*
2 * Copyright (c) 2004 Matthijs Hollemans
3 * Copyright (c) 2008-2014 Haiku, Inc. All rights reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
25 #include "SynthBridge.h"
28 // #pragma mark - SynthBridge
31 SynthBridge::SynthBridge()
33 BMidiLocalConsumer("Internal Synthesizer")
38 bool
39 SynthBridge::Init(synth_mode mode)
41 if (be_synth->LoadSynthData(mode) == B_OK) {
42 fMidiSynth.EnableInput(true, true);
43 return true;
46 return false;
50 BMidiSynth*
51 SynthBridge::MidiSynth()
53 return &fMidiSynth;
57 void
58 SynthBridge::NoteOff(uchar channel, uchar note, uchar velocity, bigtime_t time)
60 fMidiSynth.NoteOff(channel + 1, note, velocity, time / 1000);
64 void
65 SynthBridge::NoteOn(uchar channel, uchar note, uchar velocity, bigtime_t time)
67 fMidiSynth.NoteOn(channel + 1, note, velocity, time / 1000);
71 void
72 SynthBridge::KeyPressure(uchar channel, uchar note, uchar pressure,
73 bigtime_t time)
75 fMidiSynth.KeyPressure(channel + 1, note, pressure, time / 1000);
79 void
80 SynthBridge::ControlChange(uchar channel, uchar controlNumber,
81 uchar controlValue, bigtime_t time)
83 fMidiSynth.ControlChange(channel + 1, controlNumber, controlValue,
84 time / 1000);
88 void
89 SynthBridge::ProgramChange(uchar channel, uchar programNumber, bigtime_t time)
91 fMidiSynth.ProgramChange(channel + 1, programNumber, time / 1000);
95 void
96 SynthBridge::ChannelPressure(uchar channel, uchar pressure, bigtime_t time)
98 fMidiSynth.ChannelPressure(channel + 1, pressure, time / 1000);
102 void
103 SynthBridge::PitchBend(uchar channel, uchar lsb, uchar msb, bigtime_t time)
105 fMidiSynth.PitchBend(channel + 1, lsb, msb, time / 1000);
109 void
110 SynthBridge::AllNotesOff(bool justChannel, bigtime_t time)
112 fMidiSynth.AllNotesOff(justChannel, time / 1000);