当前位置: 首页>>代码示例>>C++>>正文


C++ Pm_GetDeviceInfo函数代码示例

本文整理汇总了C++中Pm_GetDeviceInfo函数的典型用法代码示例。如果您正苦于以下问题:C++ Pm_GetDeviceInfo函数的具体用法?C++ Pm_GetDeviceInfo怎么用?C++ Pm_GetDeviceInfo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Pm_GetDeviceInfo函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: keyboard_init

int keyboard_init(MidiObj* m,char* name) {
		
	m->midi_stream_out = NULL;
	m->midi_stream = NULL;
	
	// open midi device
	if(! initialized)
	{
		Pm_Initialize();
		initialized=1;
	}

	int devid= find_device_id_in(name);
	int devid_out= find_device_id_out(name);
	const PmDeviceInfo* dev_info = Pm_GetDeviceInfo(devid);
	const PmDeviceInfo* dev_info_out = Pm_GetDeviceInfo(devid_out);

	if(dev_info_out) {
		Pm_OpenOutput(&(m->midi_stream_out), devid_out, NULL, KEYBOARD_MAX_EVENTS, NULL, NULL,0);
	}
	if(dev_info) {
		Pm_OpenInput(&(m->midi_stream), devid, NULL, KEYBOARD_MAX_EVENTS, NULL, NULL);
		return 1;
	}
	return 0;
}
开发者ID:glocklueng,项目名称:midiDmxCtrlv2,代码行数:26,代码来源:keyboard.c

示例2: Pm_CountDevices

void pm_module::list_midi_devices(void)
{
	int num_devs = Pm_CountDevices();
	const PmDeviceInfo *pmInfo;

	printf("\n");

	if (num_devs == 0)
	{
		printf("No MIDI ports were found\n");
		return;
	}

	printf("MIDI input ports:\n");
	for (int i = 0; i < num_devs; i++)
	{
		pmInfo = Pm_GetDeviceInfo(i);

		if (pmInfo->input)
		{
			printf("%s %s\n", pmInfo->name, (i == Pm_GetDefaultInputDeviceID()) ? "(default)" : "");
		}
	}

	printf("\nMIDI output ports:\n");
	for (int i = 0; i < num_devs; i++)
	{
		pmInfo = Pm_GetDeviceInfo(i);

		if (pmInfo->output)
		{
			printf("%s %s\n", pmInfo->name, (i == Pm_GetDefaultOutputDeviceID()) ? "(default)" : "");
		}
	}
}
开发者ID:ccmurray,项目名称:mame,代码行数:35,代码来源:portmidi.cpp

示例3: Pm_CountDevices

void FLiveEditorManager::FindDevices()
{
	//find all our devices
	int NumDevices = Pm_CountDevices(); //needs to remain int (instead of int32) since numbers are derived from TPL that uses int
	for ( int i = 0; i < NumDevices; i++ )
	{
		const PmDeviceInfo *Info = Pm_GetDeviceInfo( i );
		if ( Info->input && !InputConnections.Find(i) )
		{
			PortMidiStream *MIDIStream;
			PmError Error = Pm_OpenInput( &MIDIStream, i, NULL, DEFAULT_BUFFER_SIZE, NULL, NULL );
			if ( Error == pmNoError )
			{
				FLiveEditorDeviceInstance DeviceInstance;
				DeviceInstance.Data.DeviceName = FString(Info->name);

				DeviceInstance.Connection.MIDIStream = MIDIStream;

				LoadDeviceData( DeviceInstance.Data.DeviceName, DeviceInstance.Data );

				InputConnections.Add( i, DeviceInstance );
			}
		}
	}
}
开发者ID:Codermay,项目名称:Unreal4,代码行数:25,代码来源:LiveEditorManager.cpp

示例4: Pm_GetDeviceInfo

/*
 * Method:    Pm_GetDeviceName
 */
JNIEXPORT jstring JNICALL Java_jportmidi_JPortMidiApi_Pm_1GetDeviceName
  (JNIEnv *env, jclass cl, jint i)
{
    const PmDeviceInfo *info = Pm_GetDeviceInfo(i);
    if (!info) return NULL;
    return (*env)->NewStringUTF(env, info->name);
}
开发者ID:AkiraShirase,项目名称:audacity,代码行数:10,代码来源:pmjni.c

示例5: Pm_CountDevices

void MidiSession::openOutputDevice(std::string device)
{
    auto numMidiInputs = Pm_CountDevices();
    auto devices = getDevices();
    
    for(auto i = 0; i < numMidiInputs; i++)
    {
        if(devices[i] == device)
        {
            if(!Pm_GetDeviceInfo(i)->opened)
                error = Pm_OpenOutput(&midiStream, i, nullptr, 3, nullptr, nullptr, 0);
            else
                std::cout<<"Device is already opened"<<std::endl;
            
            if(error != pmNoError)
            {
                std::cout<<"Trying to open device: "<<devices[i]<<std::endl;
                std::cout<<Pm_GetErrorText(error)<<std::endl;
                return;
            }
            
            midiThread = std::thread(&MidiSession::read, this);
            midiThread.detach();
            
            return;
        }
    }
}
开发者ID:DannyvanSwieten,项目名称:APAudioFramework,代码行数:28,代码来源:MidiInput.cpp

示例6: pm_find_default_device

/* utility to look up device, given a pattern,
   note: pattern is modified
 */
int pm_find_default_device(char *pattern, int is_input)
{
    int id = pmNoDevice;
    int i;
    /* first parse pattern into name, interf parts */
    char *interf_pref = ""; /* initially assume it is not there */
    char *name_pref = strstr(pattern, ", ");

    if (name_pref) { /* found separator, adjust the pointer */
        interf_pref = pattern;
        name_pref[0] = 0;
        name_pref += 2;
    } else {
        name_pref = pattern; /* whole string is the name pattern */
    }
    for (i = 0; i < pm_descriptor_index; i++) {
        const PmDeviceInfo *info = Pm_GetDeviceInfo(i);
        if (info->input == is_input &&
            strstr(info->name, name_pref) &&
            strstr(info->interf, interf_pref)) {
            id = i;
            break;
        }
    }
    return id;
}
开发者ID:lgblgblgb,项目名称:ep128emu,代码行数:29,代码来源:portmidi.c

示例7: midiInit

bool midiInit()
{
        Pm_Initialize();

        // Initialize buffer
        nbEventWaiting = 0;
        iEventWaiting = 0;

        int portIn = -1;
        int portOut = -1;
        /* List device information */
        for (int i = 0; i < Pm_CountDevices(); i++) {
                const PmDeviceInfo *info = Pm_GetDeviceInfo(i);
                if ((info->input) || (info->output)) {
                        printf("%d: %s, %s", i, info->interf, info->name);
                        if (info->input) {
                                portIn = i;
                                printf(" (input)");
                        }

                        if (info->output) {
                                portOut = i;
                                printf(" (output)");
                        }
                        printf("\n");
                }
        }

        if(portOut == -1 || portIn == -1) {
                printf("Midi port not found.\r\n");
                return -1;
        }

        return false;
}
开发者ID:amoweb,项目名称:RaspberryBoucle,代码行数:35,代码来源:midi.c

示例8: main

int main(int argc, char **argv)
{
    int argi, i;
    char *arg, *nextarg;
    PmError perr;
    PtError pterr;

    PmDeviceID dev = -1;
    int list = 0;

    for (argi = 1; argi < argc; argi++) {
        arg = argv[argi];
        nextarg = argv[argi+1];
        if (arg[0] == '-') {
            if (!strcmp(arg, "-l")) {
                list = 1;
            } else if (!strcmp(arg, "-i") && nextarg) {
                dev = atoi(nextarg);
                argi++;
            } else {
                fprintf(stderr, "Invalid invocation.\n");
                exit(1);
            }
        }
    }

    PSF(perr, Pm_Initialize, ());
    PTSF(pterr, Pt_Start, (1, dump, NULL));

    /* list devices */
    if (list) {
        int ct = Pm_CountDevices();
        PmDeviceID def = Pm_GetDefaultInputDeviceID();
        const PmDeviceInfo *devinf;

        for (i = 0; i < ct; i++) {
            devinf = Pm_GetDeviceInfo(i);
            printf("%d%s: %s%s %s\n", i, (def == i) ? "*" : "",
                (devinf->input) ? "I" : "",
                (devinf->output) ? "O" : "",
                devinf->name);
        }
    }

    /* choose device */
    if (dev == -1) {
        fprintf(stderr, "Warning: Using default device.\n");
        dev = Pm_GetDefaultInputDeviceID();
    }

    /* open it for input */
    PSF(perr, Pm_OpenInput, (&stream, dev, NULL, 1024, NULL, NULL));
    PSF(perr, Pm_SetFilter, (stream, PM_FILT_ACTIVE | PM_FILT_SYSEX));

    while (1) Pt_Sleep(1<<31);

    return 0;
}
开发者ID:GregorR,项目名称:humidity,代码行数:58,代码来源:hdumpdev.c

示例9: Pm_GetDeviceInfo

void NxMidiManager::GetMidiOutputList( std::vector<std::string> & MidiOutputList )
{
	 for (int i = 0; i < Pm_CountDevices(); i++)  {
        const PmDeviceInfo *info = Pm_GetDeviceInfo(i);
		if( info->output ) {
			MidiOutputList.push_back( string( info->name ) );
		}
	 }
}
开发者ID:nxgraphics,项目名称:NxGraphics,代码行数:9,代码来源:NxDevice_Midi_Manager.cpp

示例10: portMidi_getRealDeviceID

static PmDeviceInfo *portMidi_getDeviceInfo(int dev, int output)
{
    int i;

    i = portMidi_getRealDeviceID(dev, output);
    if (UNLIKELY(i < 0))
      return NULL;
    return ((PmDeviceInfo*)Pm_GetDeviceInfo((PmDeviceID) i));
}
开发者ID:hlolli,项目名称:csound,代码行数:9,代码来源:pmidi.c

示例11: keyboard_init

int keyboard_init() {
	Pm_Initialize();
	const PmDeviceInfo* dev_info = Pm_GetDeviceInfo(KEYBOARD_DEV_ID);
	if (dev_info) {
		Pm_OpenInput(&midi_stream, KEYBOARD_DEV_ID, NULL, KEYBOARD_MAX_EVENTS, NULL, NULL);
		return 1;
	}
	return 0;
}
开发者ID:2bt,项目名称:little-synths,代码行数:9,代码来源:keyboard.c

示例12: Pm_CountDevices

QStringList PortMidiDriver::deviceOutList() const
      {
      QStringList ol;
      int interf = Pm_CountDevices();
      for (PmDeviceID id = 0; id < interf; id++) {
            const PmDeviceInfo* info = Pm_GetDeviceInfo((PmDeviceID)id);
            if(info->output)
                ol.append(QString(info->interf) + "," + QString(info->name));
            }
      return ol;
      }
开发者ID:IsaacWeiss,项目名称:MuseScore,代码行数:11,代码来源:pm.cpp

示例13: port_init_seq

int port_init_seq()
{
    //if(seq_handle!=NULL) return 1;

    pm_status=Pm_Initialize();
    if(pm_status!=pmNoError)
    {
        fprintf(stderr, "Error initialising PortMIDI\n");
        return 0;
    }

    int i;
    const PmDeviceInfo *pm_dev_info;
    int num_devices=Pm_CountDevices();
    printf("Available MIDI devices:\n");
    for(i=0; i<num_devices; i++)
    {
        pm_dev_info=Pm_GetDeviceInfo(i);
        if(pm_dev_info->input) printf("%d: %s\n", i, pm_dev_info->name);
    }
    printf("\n");

    pm_status=Pm_OpenInput(&pm_stream, midiport, DRIVER_INFO, INPUT_BUFFER_SIZE, NULL, NULL);
    if(pm_status!=pmNoError)
    {
        fprintf(stderr, "Error opening MIDI input device\n");
    }


    /*
    	if(snd_seq_open(&seq_handle, "default", SND_SEQ_OPEN_INPUT, 0)<0) {
    		fprintf(stderr, "Error opening ALSA sequencer.\n");
    		return 0;
    	}

    	snd_seq_set_client_name(seq_handle, clientname);

    	in_port=snd_seq_create_simple_port(seq_handle, portname,
    		SND_SEQ_PORT_CAP_WRITE|SND_SEQ_PORT_CAP_SUBS_WRITE,
    		SND_SEQ_PORT_TYPE_APPLICATION);

    	if(in_port<0) {
    		fprintf(stderr, "Error creating sequencer port.\n");
    		return 0;
    	}

    	npfd=snd_seq_poll_descriptors_count(seq_handle, POLLIN);
    	pfd=(struct pollfd *)malloc(npfd*sizeof(struct pollfd));
    	snd_seq_poll_descriptors(seq_handle, pfd, npfd, POLLIN);
    */

    return 1;
}
开发者ID:ssj71,项目名称:reMID.lv2,代码行数:53,代码来源:port_midi.c

示例14: osd_list_midi_devices

void osd_list_midi_devices(void)
{
	#ifndef DISABLE_MIDI
	int num_devs = Pm_CountDevices();
	const PmDeviceInfo *pmInfo;

	printf("\n");

	if (num_devs == 0)
	{
		printf("No MIDI ports were found\n");
		return;
	}

	printf("MIDI input ports:\n");
	for (int i = 0; i < num_devs; i++)
	{
		pmInfo = Pm_GetDeviceInfo(i);

		if (pmInfo->input)
		{
			printf("%s %s\n", pmInfo->name, (i == Pm_GetDefaultInputDeviceID()) ? "(default)" : "");
		}
	}

	printf("\nMIDI output ports:\n");
	for (int i = 0; i < num_devs; i++)
	{
		pmInfo = Pm_GetDeviceInfo(i);

		if (pmInfo->output)
		{
			printf("%s %s\n", pmInfo->name, (i == Pm_GetDefaultOutputDeviceID()) ? "(default)" : "");
		}
	}
	#else
	printf("\nMIDI is not supported in this build\n");
	#endif
}
开发者ID:antervud,项目名称:MAMEHub,代码行数:39,代码来源:pmmidi.c

示例15: Pm_CountDevices

int PortMidiDriver::getDeviceIn(const QString& name)
      {
      int interf = Pm_CountDevices();
      for (int id = 0; id < interf; id++) {
            const PmDeviceInfo* info = Pm_GetDeviceInfo((PmDeviceID)id);
            if (info->input) {
                  QString n = QString(info->interf) + "," + QString(info->name);
                  if (n == name)
                        return id;
                  }
            }
      return -1;
      }
开发者ID:Angeldude,项目名称:MuseScore,代码行数:13,代码来源:pm.cpp


注:本文中的Pm_GetDeviceInfo函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。