#include <DevMidi.h>
Öffentliche Methoden | |
InMidiPort () | |
InMidiPort (const mutString &name, int devId) | |
virtual | ~InMidiPort () |
virtual void | Save (tree_storage &config) |
Save current device settings in a tree storage. | |
virtual void | Save (tree_storage &config, const Route *route) |
Save route settings (filter settings) for a given route. | |
virtual void | Load (tree_storage &config) |
Load current device settings from a tree storage. | |
virtual void | Load (tree_storage &config, Route *route) |
Loade route settings (filter settings) for a given route. | |
virtual bool | Open () |
virtual void | Close () |
virtual void | Stop () |
virtual void | Play () |
virtual void | Pause () |
virtual frac | ReadOn (frac time) |
virtual bool | NeedsRealTime () |
virtual void | SetDevId (int id) |
virtual int | GetDevId () |
virtual wxString & | GetName () |
virtual void | SetName (const wxString &s) |
void | Proceed (DWORD midiCode) |
virtual int | GetMaxChannel () const |
virtual int | GetMinChannel () const |
virtual int | GetMaxKey () const |
virtual int | GetMinKey () const |
virtual DevType | GetType () const |
virtual mutString | GetTypeName () const |
Öffentliche Attribute | |
InMidiPort * | NextMidiPort |
HMIDIIN | hMidiIn |
Private Methoden | |
void | ProceedRoute (DWORD midiCode, Route *route) |
Private Attribute | |
ChannelData | Cd [16] |
InMidiPort::InMidiPort | ( | ) | [inline] |
Definiert in Zeile 197 der Datei DevMidi.h.
: InDevice(), NextMidiPort (NULL) { }
InMidiPort::InMidiPort | ( | const mutString & | name, |
int | devId | ||
) | [inline] |
Definiert in Zeile 199 der Datei DevMidi.h.
: InDevice(devId, name), NextMidiPort (NULL) {}
virtual InMidiPort::~InMidiPort | ( | ) | [inline, virtual] |
void InMidiPort::Close | ( | ) | [virtual] |
virtual int InMidiPort::GetDevId | ( | ) | [inline, virtual] |
Definiert in Zeile 261 der Datei DevMidi.h.
Benutzt Device::DevId.
Wird benutzt von MutInputMidiDeviceShape::InitializeDialog().
{ return DevId; }
virtual int InMidiPort::GetMaxChannel | ( | ) | const [inline, virtual] |
Definiert in Zeile 279 der Datei DevMidi.h.
Wird benutzt von MutInputMidiDeviceShape::GetInputFilterPanel() und Load().
{ return 15; }
virtual int InMidiPort::GetMaxKey | ( | ) | const [inline, virtual] |
Definiert in Zeile 281 der Datei DevMidi.h.
Wird benutzt von MutInputMidiDeviceShape::GetInputFilterPanel() und Load().
{ return 127; }
virtual int InMidiPort::GetMinChannel | ( | ) | const [inline, virtual] |
Definiert in Zeile 280 der Datei DevMidi.h.
Wird benutzt von MutInputMidiDeviceShape::GetInputFilterPanel() und Load().
{ return 0; }
virtual int InMidiPort::GetMinKey | ( | ) | const [inline, virtual] |
Definiert in Zeile 282 der Datei DevMidi.h.
Wird benutzt von MutInputMidiDeviceShape::GetInputFilterPanel() und Load().
{ return 0; }
virtual wxString& InMidiPort::GetName | ( | ) | [inline, virtual] |
Definiert in Zeile 266 der Datei DevMidi.h.
Benutzt Device::Name.
Wird benutzt von Load(), Open() und MutInputMidiDeviceShape::readDialog().
{ return Name; }
virtual DevType InMidiPort::GetType | ( | ) | const [inline, virtual] |
Erneute Implementation von InDevice.
Definiert in Zeile 285 der Datei DevMidi.h.
Benutzt DTMidiPort.
{ return DTMidiPort; }
virtual mutString InMidiPort::GetTypeName | ( | ) | const [inline, virtual] |
void InMidiPort::Load | ( | tree_storage & | config, |
Route * | route | ||
) | [virtual] |
Loade route settings (filter settings) for a given route.
Some route settings (e.g. filter settings) are device type specific. This function loads them from a tree storage. config (tree_storage *) Storage class, where the data will be restored from. route (Route *) Route whos data shall be loaded.
Implementiert Device.
Definiert in Zeile 659 der Datei DevMidi.cpp.
Benutzt _(), GetMaxChannel(), GetMaxKey(), GetMinChannel(), GetMinKey(), GetName(), Route::IFrom, Route::ITo, tree_storage::Read(), RTall, RTchannel, RTelse, RTstaff und Route::Type.
{ route->Type = (RouteType) config.Read(_T("Filter Type"), (int) RTchannel); switch(route->Type) { case RTchannel: { int oldfrom, oldto; oldfrom = route->IFrom = config.Read(_T("Channel From"), GetMinChannel()); oldto = route->ITo = config.Read(_T("Channel To"), GetMaxChannel()); bool correct = true; if (route->IFrom < GetMinChannel()) { correct = false; route->IFrom = GetMinChannel(); } if (route->ITo > GetMaxChannel()) { correct = false; route->ITo = GetMaxChannel(); } if (!correct) wxMessageBox(wxString::Format(_("The Channel range %d--%d of the MIDI input device %s must be inside %d--%d. The current route had to be corrected."), oldfrom,oldto,GetName().c_str(),GetMinChannel(),GetMaxChannel()), _("Warning loading route"),wxICON_EXCLAMATION); break; } case RTstaff: { int oldfrom, oldto; route->IFrom = oldfrom = config.Read(_T("Key From"), GetMinKey()); route->ITo = oldto = config.Read(_T("Key To"), GetMaxKey()); bool correct = true; if (route->IFrom < GetMinKey()) { correct = false; route->IFrom = GetMinKey(); } if (route->ITo > GetMaxKey()) { correct = false; route->ITo = GetMaxKey(); } if (!correct) wxMessageBox(wxString::Format(_("The Channel range %d--%d of the MIDI input device must be inside %d--%d. The current route had to be corrected."), oldfrom,oldto, GetName().c_str(),GetMinKey(), GetMaxKey()), _("Warning loading route"),wxICON_EXCLAMATION); break; } case RTelse: case RTall: break; } }
void InMidiPort::Load | ( | tree_storage & | config | ) | [virtual] |
Load current device settings from a tree storage.
config (tree_storage) storage class, where the data will be loaded from.
Implementiert Device.
Definiert in Zeile 645 der Datei DevMidi.cpp.
Benutzt _(), Device::DevId, RtMidiOut::getPortCount(), RtMidiOut::getPortName(), muT, Device::Name und tree_storage::Read().
{ DevId = config.Read(_T("Device Id"), 0); Name = config.Read(_T("Device Name"), rtmidiout->getPortCount()? muT(rtmidiout->getPortName(0).c_str()):wxString(_("Unknown"))); }
virtual bool InMidiPort::NeedsRealTime | ( | ) | [inline, virtual] |
bool InMidiPort::Open | ( | ) | [virtual] |
Implementiert InDevice.
Definiert in Zeile 709 der Datei DevMidi.cpp.
Benutzt _(), Cd, Device::DevId, GetName(), hMidiIn, LAUFZEIT_ERROR0, LAUFZEIT_ERROR2 und MidiInPortFunc().
{ for (int i = 0; i < 16; i++) Cd[i].Reset(); #ifdef RTMIDI try { hMidiIn = new RtMidiIn(); } catch (RtError &error) { LAUFZEIT_ERROR0(_("Can not open Midi input devices.")); return false; } try { hMidiIn->openPort(DevId); } catch (RtError &error) { LAUFZEIT_ERROR2(_("Can not open Midi input device no. %d (%s)."), DevId, (GetName().c_str())); return false; } hMidiIn->setCallback(mycallback, this); #else midiInOpen(&hMidiIn, DevId, (DWORD)MidiInPortFunc, (DWORD)this, CALLBACK_FUNCTION); midiInStart(hMidiIn); #endif return true; }
virtual void InMidiPort::Pause | ( | ) | [inline, virtual] |
virtual void InMidiPort::Play | ( | ) | [inline, virtual] |
void InMidiPort::Proceed | ( | DWORD | midiCode | ) |
Definiert in Zeile 835 der Datei DevMidi.cpp.
Benutzt FLUSH_UPDATE_UI, Route::GetNext(), InDevice::GetRoutes(), ProceedRoute(), RTall, RTchannel, RTelse und RTstaff.
{ char DidOut = 0; for (Route *R = GetRoutes(); R; R = R->GetNext()) switch ( R->Type ) { case RTchannel: if ( R->Check(midiCode & 0x0F) ) { ProceedRoute(midiCode, R); DidOut = 1; } break; case RTstaff: if ( ((midiCode & 0xF0) != 0x80 && (midiCode & 0xF0) != 0x90) || R->Check((midiCode >> 8) & 0xFF) ) { ProceedRoute(midiCode, R); DidOut = 1; } break; case RTelse: if ( DidOut ) break; case RTall: ProceedRoute(midiCode, R); } FLUSH_UPDATE_UI; }
void InMidiPort::ProceedRoute | ( | DWORD | midiCode, |
Route * | route | ||
) | [private] |
Definiert in Zeile 755 der Datei DevMidi.cpp.
Benutzt Route::Active, AddKey(), ChannelData::BankSelectLSB, ChannelData::BankSelectMSB, Route::Box, Cd, DEBUGLOG, DeleteKey(), Route::GetId(), Route::GetOutDevice(), lMidiCode, MidiAnalysis(), OutDevice::NoteOff(), OutDevice::NoteOn(), ChannelData::Sound, OutDevice::Sustain() und ChannelData::Sustain.
Wird benutzt von Proceed().
{ #ifdef DEBUG if (midiCode != 0xf8) DEBUGLOG(midiio,_T("midiCode = %x"), midiCode); #endif int Box = route->Box; BYTE MidiChannel = midiCode & 0x0F; BYTE MidiStatus = midiCode & 0xF0; switch ( MidiStatus ) { case 0x90: // Note On if ( (midiCode & 0x7f0000) > 0 ) { if ( route->Active ) AddKey(Box, (midiCode >> 8) & 0xff, route->GetId()); if ( route->GetOutDevice() ) route->GetOutDevice()->NoteOn(Box, (midiCode >> 8) & 0xff, (midiCode >> 16) & 0xff, route, MidiChannel, &Cd[MidiChannel]); break; } case 0x80: // Note Off if ( route->Active ) DeleteKey(Box,(midiCode >> 8) & 0xff, route->GetId()); if ( route->GetOutDevice() ) route->GetOutDevice()->NoteOff(Box, (midiCode >> 8) & 0xff, (midiCode >> 16) & 0xff, route, MidiChannel); break; case 0xC0: // Programm Change Cd[MidiChannel].Sound = (midiCode >> 8) & 0xff; break; case 0xB0: // Control Change { int control = (midiCode >> 8) & 0xff; int data = (midiCode >> 16) & 0xff; if ( control == 64 ) { Cd[MidiChannel].Sustain = data; if ( route->GetOutDevice() ) route->GetOutDevice()->Sustain(Cd[MidiChannel].Sustain, MidiChannel); break; } else if ( control == 0 ) // BankSelectMSB { Cd[MidiChannel].BankSelectMSB = data; break; } else if ( control == 32 ) // BankSelectLSB { Cd[MidiChannel].BankSelectLSB =data; break; } } case 0xA0: case 0xD0: // Key Pressure, Controler, Channel Pressure //3 ?? break; } // Midianalyse int lMidiCode[8] = { 3, 3, 3, 3, 2, 2, 3, 1 }; if ( Box >= 0 && route->Active ) for (int i = 0; i < lMidiCode[MidiStatus >> 5]; i++) { MidiAnalysis(Box,midiCode & 0xff); midiCode >>= 8; } }
void InMidiPort::Save | ( | tree_storage & | config, |
const Route * | route | ||
) | [virtual] |
Save route settings (filter settings) for a given route.
Some route settings (e.g. filter settings) are device type specific. This function saves them in a tree storage. config (tree_storage *) Storage class, where the data will be saved. route (Route *) Route whos data shall be saved.
Implementiert Device.
Definiert in Zeile 623 der Datei DevMidi.cpp.
Benutzt Route::IFrom, Route::ITo, RTall, RTchannel, RTelse, RTstaff, Route::Type und tree_storage::Write().
{ config.Write(_T("Filter Type"), route->Type); switch(route->Type) { case RTchannel: config.Write(_T("Channel From"), route->IFrom); config.Write(_T("Channel To"), route->ITo); break; case RTstaff: config.Write(_T("Key From"), route->IFrom); config.Write(_T("Key To"), route->ITo); break; case RTelse: case RTall: break; } }
void InMidiPort::Save | ( | tree_storage & | config | ) | [virtual] |
Save current device settings in a tree storage.
config (tree_storage) storage class, where the data will be saved.
Implementiert Device.
Definiert in Zeile 611 der Datei DevMidi.cpp.
Benutzt Device::DevId, Device::Name und tree_storage::Write().
virtual void InMidiPort::SetDevId | ( | int | id | ) | [inline, virtual] |
Erneute Implementation von Device.
Definiert in Zeile 256 der Datei DevMidi.h.
Benutzt Device::DevId, RtMidiIn::getPortName(), muT und Device::Name.
Wird benutzt von MutInputMidiDeviceShape::readDialog().
virtual void InMidiPort::SetName | ( | const wxString & | s | ) | [inline, virtual] |
virtual void InMidiPort::Stop | ( | ) | [inline, virtual] |
ChannelData InMidiPort::Cd[16] [private] |
Definiert in Zeile 309 der Datei DevMidi.h.
Wird benutzt von Open() und ProceedRoute().
HMIDIIN InMidiPort::hMidiIn |