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


C++ DPRINT函数代码示例

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


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

示例1: IopDeviceStatus

static NTSTATUS
IopDeviceStatus(PPLUGPLAY_CONTROL_STATUS_DATA StatusData)
{
    PDEVICE_OBJECT DeviceObject;
    PDEVICE_NODE DeviceNode;
    ULONG Operation = 0;
    ULONG DeviceStatus = 0;
    ULONG DeviceProblem = 0;
    UNICODE_STRING DeviceInstance;
    NTSTATUS Status;

    DPRINT("IopDeviceStatus() called\n");

    Status = IopCaptureUnicodeString(&DeviceInstance, &StatusData->DeviceInstance);
    if (!NT_SUCCESS(Status))
    {
        return Status;
    }

    DPRINT("Device name: '%wZ'\n", &DeviceInstance);

    _SEH2_TRY
    {
        Operation = StatusData->Operation;
        if (Operation == PNP_SET_DEVICE_STATUS)
        {
            DeviceStatus = StatusData->DeviceStatus;
            DeviceProblem = StatusData->DeviceProblem;
        }
    }
    _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
    {
        if (DeviceInstance.Buffer != NULL)
        {
            ExFreePool(DeviceInstance.Buffer);
        }
        _SEH2_YIELD(return _SEH2_GetExceptionCode());
    }
    _SEH2_END;

    /* Get the device object */
    DeviceObject = IopGetDeviceObjectFromDeviceInstance(&DeviceInstance);
    if (DeviceInstance.Buffer != NULL)
    {
        ExFreePool(DeviceInstance.Buffer);
    }
    if (DeviceObject == NULL)
    {
        return STATUS_NO_SUCH_DEVICE;
    }

    DeviceNode = IopGetDeviceNode(DeviceObject);

    switch (Operation)
    {
        case PNP_GET_DEVICE_STATUS:
            DPRINT("Get status data\n");
            DeviceStatus = IopGetDeviceNodeStatus(DeviceNode);
            DeviceProblem = DeviceNode->Problem;
            break;

        case PNP_SET_DEVICE_STATUS:
            DPRINT1("Set status data is NOT SUPPORTED\n");
            break;

        case PNP_CLEAR_DEVICE_STATUS:
            DPRINT1("FIXME: Clear status data!\n");
            break;
    }

    ObDereferenceObject(DeviceObject);

    if (Operation == PNP_GET_DEVICE_STATUS)
    {
        _SEH2_TRY
        {
            StatusData->DeviceStatus = DeviceStatus;
            StatusData->DeviceProblem = DeviceProblem;
        }
        _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
        {
            Status = _SEH2_GetExceptionCode();
        }
        _SEH2_END;
    }
开发者ID:GYGit,项目名称:reactos,代码行数:85,代码来源:plugplay.c

示例2: InitDevice

static NTSTATUS InitDevice(
    IN PUNICODE_STRING RegistryPath,
    IN PVOID Context)
{
//    PDEVICE_INSTANCE Instance = Context;
    PDEVICE_OBJECT DeviceObject; // = Context;
    PDEVICE_EXTENSION Parameters; // = DeviceObject->DeviceExtension;
    UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\\Device\\MidiOut0");
    UNICODE_STRING SymlinkName = RTL_CONSTANT_STRING(L"\\??\\MidiOut0");
//    CONFIG Config;
    RTL_QUERY_REGISTRY_TABLE Table[2];
    NTSTATUS s;

    // This is TEMPORARY, to ensure that we don't process more than 1 device.
    // I'll remove this limitation in the future.
    if (DeviceCount > 0)
    {
        DPRINT("Sorry - only 1 device supported by MPU401 driver at present :(\n");
        return STATUS_NOT_IMPLEMENTED;
    }

    DPRINT("Creating IO device\n");

    s = IoCreateDevice(Context, // driverobject
			  sizeof(DEVICE_EXTENSION),
			  &DeviceName,
			  FILE_DEVICE_SOUND, // Correct?
			  0,
			  FALSE,
			  &DeviceObject);

    if (!NT_SUCCESS(s))
        return s;

    DPRINT("Device Extension at 0x%x\n", DeviceObject->DeviceExtension);
    Parameters = DeviceObject->DeviceExtension;

    DPRINT("Creating DOS link\n");

    /* Create the dos device link */
    IoCreateSymbolicLink(&SymlinkName,
		       &DeviceName);

    DPRINT("Initializing device\n");

//    DPRINT("Allocating memory for parameters structure\n");
    // Bodged:
//    Parameters = (PDEVICE_EXTENSION)ExAllocatePool(NonPagedPool, sizeof(DEVICE_EXTENSION));
//    DeviceObject->DeviceExtension = Parameters;
//    Parameters = Instance->DriverObject->DriverExtension;

    DPRINT("DeviceObject at 0x%x, DeviceExtension at 0x%x\n", DeviceObject, Parameters);

    if (! Parameters)
    {
        DPRINT("NULL POINTER!\n");
        return STATUS_INSUFFICIENT_RESOURCES;
    }

//    Instance->DriverObject->DriverExtension = Parameters;

    DPRINT("Setting reg path\n");
    Parameters->RegistryPath = RegistryPath;
//    Parameters->DriverObject = Instance->DriverObject;

    DPRINT("Zeroing table memory and setting query routine\n");
    RtlZeroMemory(Table, sizeof(Table));
    Table[0].QueryRoutine = LoadSettings;

    DPRINT("Setting port and IRQ defaults\n");
    Parameters->Port = DEFAULT_PORT;
    Parameters->IRQ = DEFAULT_IRQ;

// Only to be enabled once we can get support for multiple cards working :)
/*
    DPRINT("Loading settings from: %S\n", RegistryPath);

    s = RtlQueryRegistryValues(RTL_REGISTRY_ABSOLUTE, RegistryPath, Table,
                                &Parameters, NULL);
*/

    if (! NT_SUCCESS(s))
        return s;

    DPRINT("Port 0x%x  IRQ %d\n", Parameters->Port, Parameters->IRQ);

//    Instance->P

    // Enter UART mode (should be done in init phase
    if (! InitUARTMode(Parameters->Port))
    {
        DPRINT("UART mode initialization FAILED!\n");
        // Set state indication somehow
        // Failure - what error code do we give?!
        // return STATUS_????
    }

    DeviceCount ++;

    return STATUS_SUCCESS;
//.........这里部分代码省略.........
开发者ID:hoangduit,项目名称:reactos,代码行数:101,代码来源:mpu401.c

示例3: BBGetBuildNO

/// <summary>
/// Get kernel build number
/// </summary>
/// <param name="pBuildNO">Build number.</param>
/// <returns>Status code</returns>
NTSTATUS BBGetBuildNO( OUT PULONG pBuildNo )
{
    ASSERT( pBuildNo != NULL );
    if (pBuildNo == 0)
        return STATUS_INVALID_PARAMETER;

    NTSTATUS status = STATUS_SUCCESS;
    UNICODE_STRING strRegKey = { 0 };
    UNICODE_STRING strRegValue = { 0 };
    UNICODE_STRING strVerVal = { 0 };
    HANDLE hKey = NULL;
    OBJECT_ATTRIBUTES keyAttr = { 0 };
    RtlUnicodeStringInit( &strRegKey, L"\\Registry\\Machine\\Software\\Microsoft\\Windows NT\\CurrentVersion" );
    RtlUnicodeStringInit( &strRegValue, L"BuildLabEx" );

    InitializeObjectAttributes( &keyAttr, &strRegKey, OBJ_KERNEL_HANDLE | OBJ_CASE_INSENSITIVE, NULL, NULL );

    status = ZwOpenKey( &hKey, KEY_READ, &keyAttr );
    if (NT_SUCCESS( status ))
    {
        PKEY_VALUE_FULL_INFORMATION pValueInfo = ExAllocatePoolWithTag( PagedPool, 0x1000, BB_POOL_TAG );
        ULONG bytes = 0;

        if (pValueInfo)
        {
            status = ZwQueryValueKey( hKey, &strRegValue, KeyValueFullInformation, pValueInfo, 0x1000, &bytes );
            if (NT_SUCCESS( status ))
            {
                PWCHAR pData = (PWCHAR)((PUCHAR)pValueInfo->Name + pValueInfo->NameLength);
                for (ULONG i = 0; i < pValueInfo->DataLength; i++)
                {
                    if (pData[i] == L'.')
                    {
                        for (ULONG j = i + 1; j < pValueInfo->DataLength; j++)
                        {
                            if (pData[j] == L'.')
                            {
                                strVerVal.Buffer = &pData[i] + 1;
                                strVerVal.Length = strVerVal.MaximumLength = (USHORT)((j - i) * sizeof( WCHAR ));
                                status = RtlUnicodeStringToInteger( &strVerVal, 10, pBuildNo );

                                goto skip1;
                            }
                        }
                    }
                }

            skip1:;
            }

            ExFreePoolWithTag( pValueInfo, BB_POOL_TAG );
        }
        else
            status = STATUS_NO_MEMORY;

        ZwClose( hKey );
    }
    else
        DPRINT( "BlackBone: %s: ZwOpenKey failed with status 0x%X\n", __FUNCTION__, status );

    return status;

}
开发者ID:Retord,项目名称:Blackbone,代码行数:68,代码来源:BlackBoneDrv.c

示例4: iprop_get_updates_1

kdb_incr_result_t *
iprop_get_updates_1(kdb_last_t *arg, struct svc_req *rqstp)
{
	static kdb_incr_result_t ret;
	char *whoami = "iprop_get_updates_1";
	int kret;
	kadm5_server_handle_t handle = global_server_handle;
	char *client_name = NULL, *service_name = NULL;
	gss_name_t name = NULL;
	OM_uint32 min_stat;
	char obuf[256] = {0};

	/* default return code */
	ret.ret = UPDATE_ERROR;

	DPRINT(("%s: start, last_sno=%u\n", whoami, (ulong_t)arg->last_sno));

	if (!handle) {
		krb5_klog_syslog(LOG_ERR,
				gettext("%s: server handle is NULL"),
					whoami);
		goto out;
	}

	if (setup_gss_names(rqstp, &client_name, &service_name) < 0) {
		krb5_klog_syslog(LOG_ERR,
			gettext("%s: setup_gss_names failed"),
			whoami);
		goto out;
	}

	DPRINT(("%s: clprinc=`%s'\n\tsvcprinc=`%s'\n",
		whoami, client_name, service_name));

	if (!(name = get_clnt_name(rqstp))) {
		krb5_klog_syslog(LOG_ERR,
			gettext("%s: Couldn't obtain client's name"),
			whoami);
		goto out;
	}
	if (!kadm5int_acl_check(handle->context,
		    name,
		    ACL_IPROP,
		    NULL,
		    NULL)) {
		ret.ret = UPDATE_PERM_DENIED;

		audit_kadmind_unauth(rqstp->rq_xprt, l_port,
				    whoami,
				    "<null>", client_name);
		krb5_klog_syslog(LOG_NOTICE, LOG_UNAUTH, whoami,
				"<null>", client_name, service_name,
				client_addr(rqstp, abuf));
		goto out;
	}

	kret = ulog_get_entries(handle->context, *arg, &ret);

	if (ret.ret == UPDATE_OK) {
		(void) snprintf(obuf, sizeof (obuf),
		gettext("%s; Incoming SerialNo=%u; Outgoing SerialNo=%u"),
				replystr(ret.ret),
				(ulong_t)arg->last_sno,
				(ulong_t)ret.lastentry.last_sno);
	} else {
		(void) snprintf(obuf, sizeof (obuf),
		gettext("%s; Incoming SerialNo=%u; Outgoing SerialNo=N/A"),
				replystr(ret.ret),
				(ulong_t)arg->last_sno);
	}

	audit_kadmind_auth(rqstp->rq_xprt, l_port,
			whoami,
			obuf, client_name, kret);

	krb5_klog_syslog(LOG_NOTICE, LOG_DONE, whoami,
			obuf,
			((kret == 0) ? "success" : error_message(kret)),
			client_name, service_name,
			client_addr(rqstp, abuf));

out:
	if (nofork)
		debprret(whoami, ret.ret, ret.lastentry.last_sno);
	if (client_name)
		free(client_name);
	if (service_name)
		free(service_name);
	if (name)
		gss_release_name(&min_stat, &name);
	return (&ret);
}
开发者ID:AlainODea,项目名称:illumos-gate,代码行数:92,代码来源:ipropd_svc.c

示例5: HalpGetPCIData

ULONG
NTAPI
HalpGetPCIData(IN PBUS_HANDLER BusHandler,
               IN PBUS_HANDLER RootHandler,
               IN PCI_SLOT_NUMBER Slot,
               IN PVOID Buffer,
               IN ULONG Offset,
               IN ULONG Length)
{
    UCHAR PciBuffer[PCI_COMMON_HDR_LENGTH];
    PPCI_COMMON_CONFIG PciConfig = (PPCI_COMMON_CONFIG)PciBuffer;
    ULONG Len = 0;

#ifdef SARCH_XBOX
    /* Trying to get PCI config data from devices 0:0:1 and 0:0:2 will completely
     * hang the Xbox. Also, the device number doesn't seem to be decoded for the
     * video card, so it appears to be present on 1:0:0 - 1:31:0.
     * We hack around these problems by indicating "device not present" for devices
     * 0:0:1, 0:0:2, 1:1:0, 1:2:0, 1:3:0, ...., 1:31:0 */
    if ((0 == BusHandler->BusNumber && 0 == Slot.u.bits.DeviceNumber &&
         (1 == Slot.u.bits.FunctionNumber || 2 == Slot.u.bits.FunctionNumber)) ||
        (1 == BusHandler->BusNumber && 0 != Slot.u.bits.DeviceNumber))
    {
        DPRINT("Blacklisted PCI slot\n");
        if (0 == Offset && sizeof(USHORT) <= Length)
        {
            *(PUSHORT)Buffer = PCI_INVALID_VENDORID;
            return sizeof(USHORT);
        }
        return 0;
    }
#endif

    /* Normalize the length */
    if (Length > sizeof(PCI_COMMON_CONFIG)) Length = sizeof(PCI_COMMON_CONFIG);

    /* Check if this is a vendor-specific read */
    if (Offset >= PCI_COMMON_HDR_LENGTH)
    {
        /* Read the header */
        HalpReadPCIConfig(BusHandler, Slot, PciConfig, 0, sizeof(ULONG));

        /* Make sure the vendor is valid */
        if (PciConfig->VendorID == PCI_INVALID_VENDORID) return 0;
    }
    else
    {
        /* Read the entire header */
        Len = PCI_COMMON_HDR_LENGTH;
        HalpReadPCIConfig(BusHandler, Slot, PciConfig, 0, Len);

        /* Validate the vendor ID */
        if (PciConfig->VendorID == PCI_INVALID_VENDORID)
        {
            /* It's invalid, but we want to return this much */
            Len = sizeof(USHORT);
        }

        /* Now check if there's space left */
        if (Len < Offset) return 0;

        /* There is, so return what's after the offset and normalize */
        Len -= Offset;
        if (Len > Length) Len = Length;

        /* Copy the data into the caller's buffer */
        RtlMoveMemory(Buffer, PciBuffer + Offset, Len);

        /* Update buffer and offset, decrement total length */
        Offset += Len;
        Buffer = (PVOID)((ULONG_PTR)Buffer + Len);
        Length -= Len;
    }

    /* Now we still have something to copy */
    if (Length)
    {
        /* Check if it's vendor-specific data */
        if (Offset >= PCI_COMMON_HDR_LENGTH)
        {
            /* Read it now */
            HalpReadPCIConfig(BusHandler, Slot, Buffer, Offset, Length);
            Len += Length;
        }
    }

    /* Update the total length read */
    return Len;
}
开发者ID:RareHare,项目名称:reactos,代码行数:89,代码来源:pcibus.c

示例6: write_xmms_config

void write_xmms_config() {
	/*char tempname[100];*/
	char *tempname = (char *)malloc(sizeof(char)*100);
	int count;
	GSList *position = cdcover_config.cover_searchpaths;
	GSList *positionext = cdcover_config.cover_extensions;
	mcs_handle_t *config;

	DPRINT (__DEBUG_GENERAL__,"Writing config");

	config = aud_cfg_db_open ();
	if (config) {
		// Window position
		aud_cfg_db_set_bool (config,PLUGIN_NAME,"savewindowpos",cdcover_config.save_window_pos);
		aud_cfg_db_set_int  (config,PLUGIN_NAME,"windowposx",cdcover_config.winpos_x);
		aud_cfg_db_set_int  (config,PLUGIN_NAME,"windowposy",cdcover_config.winpos_y);

		// Aspect ratio
		aud_cfg_db_set_bool (config,PLUGIN_NAME,"aspectratio",cdcover_config.preserve_aspectratio);

		// Iterate through the search list and save the paths
		count=0;
		while (position!=NULL) {
			count++;
			sprintf (tempname,"path%d",count);
			aud_cfg_db_set_string (config,PLUGIN_NAME,tempname,position->data);
			//printf("Wrote path %s (%d, %s)\n", (char *)position->data, count, tempname);
			position = g_slist_next (position);
		}
		//printf("Done writing paths\n");

		// Delete the next key, so there's a hole and read_xmms_config can stop here
		// Not too nice, as we probably leave garbage in the xmms config file
		sprintf (tempname,"path%d",count+1);
		aud_cfg_db_unset_key (config,PLUGIN_NAME,tempname);

		// Iterate through the search list and save the extensions
		count=0;
		//printf("About to write extensions\n");
		while (positionext!=NULL) {
			count++;
			sprintf (tempname,"ext%d",count);
			aud_cfg_db_set_string (config,PLUGIN_NAME,tempname,positionext->data);
			//printf("Wrote extension %s (%d, %s)\n", (char *)positionext->data, count, tempname);
			positionext = g_slist_next (positionext);
		}
		//printf("Done with the extensions too\n");

		// Delete the next key, so there's a hole and read_xmms_config can stop here
		// Not too nice, as we probably leave garbage in the xmms config file
		sprintf (tempname,"ext%d",count+1);
		aud_cfg_db_unset_key (config,PLUGIN_NAME,tempname);

		// Save the skin
		if (cdcover_config.skin_path!=NULL) {
			// Save the user selected skin
			aud_cfg_db_set_string (config,PLUGIN_NAME,"skinpath",cdcover_config.skin_path);
		} else {
			// Built in default skin, delete the key
			aud_cfg_db_unset_key (config,PLUGIN_NAME,"skinpath");
		}

		// Write and then free the config
		//printf("About to close config file\n");
		aud_cfg_db_close (config);
		//printf("Closed config file\n");
	} else {
		DPRINT (__DEBUG_GENERAL__,"cannot open config file for writing");
	}
}
开发者ID:apocalyptech,项目名称:audacious-cdcover,代码行数:70,代码来源:configmgm.c

示例7: pv_update

dp_result_t pv_update(pv_t *pv, dpid_t owner)
{
	size_t len, hdrlen;
	pv_peer_t *peer;
	assoctab_item_t *pe;
	pv_var_t *pvar;
	dp_result_t err;
	playerHdl_t errHdl;
	time_t interval;
	int i, j;
	char buf[dpio_MAXLEN_RELIABLE];

	if (!pv) {
		DPRINT(("pv_update: pv null\n"));
		return dp_RES_BUG;
	}

	/* Wait 'til previous transmission has had time to get sent. */
	if ((long)(pv->dp->now - pv->next_send) < 0) return dp_RES_OK;
	/* Set default next-check-time if no transmission this time. */
	pv->next_send = pv->dp->now + pv->dp->clocksPerSec / 8;

	/* To propagate the given id's variables, need to get access to them */
	peer = (pv_peer_t *)assoctab_subscript(pv->peers, owner);
	if (!peer) {
		/*DPRINT(("pv_update: no variables for player %d\n", owner)); */
		return dp_RES_OK;
	}
	/*DPRINT(("pv_update: peer->dirty is %d for player %d\n", peer->dirty, owner));*/

	/* If it's time to start a new cycle, do it. */
	if (pv->cur_key_index == -1) {
		if (pv->new_ndests > 0) {
			/* New hosts have been added since last cycle. */
			/* Start a host update cycle. */

			/* Copy new host list. */
			pv->cur_ndests = pv->new_ndests;
			memcpy(pv->cur_dests, pv->new_dests, pv->new_ndests * sizeof(pv->new_dests[0]));
			/* Reset new host list. */
			pv->new_ndests = 0;

			/* Fill key list with all public keys for this player. */
			for (i=j=0; i<peer->vars->n_used && j<dp_PLAYERDATA_NKEYS_MAX; i++) {
				pe = assoctab_getkey(peer->vars, i);
				if (!pe) break;	/* horrible error */
				pvar = (pv_var_t *) &pe->value;
				if (!(pvar->flags & dp_PLAYERDATA_FLAG_NOFLOOD)) {
					pv->cur_keys[j++] = pe->key;
				}
			}
			/* Early exit if no public variables. */
			if (j == 0) return dp_RES_OK;
			pv->cur_nkeys = j;
			DPRINT(("pv_update: starting new host update cycle. nkeys %d, ndests %d\n", pv->cur_nkeys, pv->cur_ndests));
			/* Trigger start. */
			pv->cur_key_index = 0;
			pv->cur_offset = 0;
		} else if (peer->dirty > 0) {
			/* Varible values have changed since last cycle. */
			/* Start a variable update cycle. */
			peer->dirty = FALSE;
			DPRINT(("pv_update: Clearing peer->dirty for player %d\n", owner));

			/* Set host list to 'all other hosts in game'. */
			pv->cur_ndests = dp_getBroadcastHdls(pv->dp, pv->cur_dests);

			/* Fill key list with all dirty variables.  Mark them clean. */
			for (i=j=0; i<peer->vars->n_used && j<dp_PLAYERDATA_NKEYS_MAX; i++) {
				pe = assoctab_getkey(peer->vars, i);
				if (!pe) break;	/* horrible error */
				pvar = (pv_var_t *) &pe->value;
				if ((pvar->flags & dp_PLAYERDATA_FLAG_DIRTY)
				&&  !(pvar->flags & dp_PLAYERDATA_FLAG_NOFLOOD)) {
					pv->cur_keys[j++] = pe->key;
					pvar->flags &= ~dp_PLAYERDATA_FLAG_DIRTY;
				}
			}
			/* Early exit if no other hosts in game (after clearing dirty!). */
			if (pv->cur_ndests <= 0) return dp_RES_OK;
			/* Early exit if no dirty public variables. */
			if (j == 0) return dp_RES_OK;
			pv->cur_nkeys = j;
			DPRINT(("pv_update: starting new variable update cycle. nkeys %d, ndests %d\n", pv->cur_nkeys, pv->cur_ndests));
			/* Trigger start. */
			pv->cur_key_index = 0;
			pv->cur_offset = 0;
		}
	}

	/* Are we in the middle of an update? */
	if (pv->cur_key_index == -1) return dp_RES_OK;	/* No. */

	/* Get a pointer to the variable we're working on.  Make sure it's
	 * still there, still clean, and still needs data transferred.
	 */
	do {
		pvar = (pv_var_t *)assoctab_subscript(peer->vars, pv->cur_keys[pv->cur_key_index]);
		/* Has it been deleted or changed or finished? */
		if (!pvar
//.........这里部分代码省略.........
开发者ID:jleclanche,项目名称:darkdust-ctp2,代码行数:101,代码来源:dppv.c

示例8: ProcessPlayingNotes

DWORD WINAPI
ProcessPlayingNotes(
    LPVOID parameter)
{
    DeviceInfo* device_info = (DeviceInfo*) parameter;
    NTSTATUS status;
    IO_STATUS_BLOCK io_status_block;
    DWORD arp_notes;

    DPRINT("Note processing started\n");

    /* We lock the note list only while accessing it */

#ifdef CONTINUOUS_NOTES
    while ( WaitForSingleObject(the_device->work_available, INFINITE), !device_info->terminate_thread )
#endif
    {
        NoteNode* node;

        /* Number of notes being arpeggiated */
        arp_notes = 1;

        EnterCriticalSection(&device_lock);

        /* Calculate how much time to allocate to each playing note */

        DPRINT("%d notes active\n", (int) device_info->playing_notes_count);

        node = device_info->note_list;

        while ( ( node != NULL ) && ( arp_notes <= POLYPHONY ) )
        {
            BEEP_SET_PARAMETERS beep_data;
            DWORD actually_playing = 0;

            double frequency = node->note;

            DPRINT("playing..\n");

            frequency = frequency / 12;
            frequency = pow(2, frequency);
            frequency = 8.1758 * frequency;

            if (device_info->playing_notes_count > POLYPHONY)
                actually_playing = POLYPHONY;
            else
                actually_playing = device_info->playing_notes_count;

            DPRINT("Frequency %f\n", frequency);

            // TODO
            beep_data.Frequency = (DWORD) frequency;
            beep_data.Duration = TIMESLICE_SIZE / actually_playing; /* device_info->playing_notes_count; */

            status = NtDeviceIoControlFile(device_info->kernel_device,
                                           NULL,
                                           NULL,
                                           NULL,
                                           &io_status_block,
                                           IOCTL_BEEP_SET,
                                           &beep_data,
                                           sizeof(BEEP_SET_PARAMETERS),
                                           NULL,
                                           0);

            if ( ! NT_SUCCESS(status) )
            {
                DPRINT("ERROR %d\n", (int) GetLastError());
            }

            SleepEx(beep_data.Duration, TRUE);

            if ( device_info->refresh_notes )
            {
                device_info->refresh_notes = FALSE;
                break;
            }

            arp_notes ++;
            node = node->next;
        }

        LeaveCriticalSection(&device_lock);
    }

    return 0;
}
开发者ID:Moteesh,项目名称:reactos,代码行数:87,代码来源:beepmidi.c

示例9: OpenDevice

MMRESULT
OpenDevice(
    DeviceInfo** private_data,
    MIDIOPENDESC* open_desc,
    DWORD flags)
{
    NTSTATUS status;
    HANDLE heap;
    HANDLE kernel_device;
    UNICODE_STRING beep_device_name;
    OBJECT_ATTRIBUTES attribs;
    IO_STATUS_BLOCK status_block;

    /* One at a time.. */
    if ( the_device )
    {
        DPRINT("Already allocated\n");
        return MMSYSERR_ALLOCATED;
    }

    /* Make the device name into a unicode string and open it */

    RtlInitUnicodeString(&beep_device_name,
                            L"\\Device\\Beep");

    InitializeObjectAttributes(&attribs,
                                &beep_device_name,
                                0,
                                NULL,
                                NULL);

    status = NtCreateFile(&kernel_device,
                            FILE_READ_DATA | FILE_WRITE_DATA,
                            &attribs,
                            &status_block,
                            NULL,
                            0,
                            FILE_SHARE_READ | FILE_SHARE_WRITE,
                            FILE_OPEN_IF,
                            0,
                            NULL,
                            0);

    if ( ! NT_SUCCESS(status) )
    {
        DPRINT("Could not connect to BEEP device - %d\n", (int) GetLastError());
        return MMSYSERR_ERROR;
    }

    DPRINT("Opened!\n");

    /* Allocate and initialize the device info */

    heap = GetProcessHeap();

    the_device = HeapAlloc(heap, HEAP_ZERO_MEMORY, sizeof(DeviceInfo));

    if ( ! the_device )
    {
        DPRINT("Out of memory\n");
        return MMSYSERR_NOMEM;
    }

    /* Initialize */
    the_device->kernel_device = kernel_device;
    the_device->playing_notes_count = 0;
    the_device->note_list = NULL;
    the_device->thread_handle = 0;
    the_device->terminate_thread = FALSE;
    the_device->running_status = 0;

    // TODO
    the_device->mme_handle = (HDRVR) open_desc->hMidi;
    the_device->callback = open_desc->dwCallback;
    the_device->instance = open_desc->dwInstance;
    the_device->flags = flags;

    /* Store the pointer in the user data */
    *private_data = the_device;

    /* This is threading-related code */
#ifdef CONTINUOUS_NOTES
    the_device->work_available = CreateEvent(NULL, TRUE, FALSE, NULL);

    if ( ! the_device->work_available )
    {
        DPRINT("CreateEvent failed\n");
        HeapFree(heap, 0, the_device);
        return MMSYSERR_NOMEM;
    }

    the_device->thread_handle = CreateThread(NULL,
                                             0,
                                             ProcessPlayingNotes,
                                             (PVOID) the_device,
                                             0,
                                             NULL);

    if ( ! the_device->thread_handle )
    {
//.........这里部分代码省略.........
开发者ID:Moteesh,项目名称:reactos,代码行数:101,代码来源:beepmidi.c

示例10: MAVMissionOutput_40hz

void MAVMissionOutput_40hz(void)
{
#if (FLIGHT_PLAN_TYPE == FP_WAYPOINTS) // LOGO_WAYPOINTS cannot be uploaded / downloaded
	vect3_32t wp;

	if (mavlink_flags.mavlink_send_waypoint_reached == 1)
	{
		mavlink_flags.mavlink_send_waypoint_reached = 0;
		mavlink_msg_mission_item_reached_send(MAVLINK_COMM_0, mav_waypoint_reached);
	}

	if (mavlink_flags.mavlink_send_waypoint_changed == 1)
	{
		mavlink_flags.mavlink_send_waypoint_changed = 0;
		mavlink_msg_mission_current_send(MAVLINK_COMM_0, mav_waypoint_changed);
	}

//static inline void mavlink_msg_mission_item_reached_send(mavlink_channel_t chan, uint16_t seq)
//static inline void mavlink_msg_mission_current_send(mavlink_channel_t chan, uint16_t seq)

	// CHECK WHETHER WAYPOINT PROTOCOL HAS TIMED OUT WAITING ON A RESPONSE
	if (mavlink_waypoint_timeout  <= 0)
	{
		if (mavlink_flags.mavlink_sending_waypoints ||  mavlink_flags.mavlink_receiving_waypoints)
		{
			//send_text((uint8_t *)"Timeout on waypoint protocol.\r\n");
			DPRINT("Timeout on waypoint protocol.\r\n");
		}
		mavlink_flags.mavlink_sending_waypoints   = false;
		mavlink_flags.mavlink_receiving_waypoints = false;
	}

//	if (mavlink_flags.mavlink_receiving_waypoints == 1)
	if (mavlink_flags.mavlink_request_specific_waypoint == 1)
	{
		DPRINT("requesting waypoint: %u\r\n", waypoint_request_i);
			//mavlink_flags.waypoint_request_i = 0;
//static inline void mavlink_msg_mission_request_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint16_t seq)
		mavlink_msg_mission_request_send(MAVLINK_COMM_0, mavlink_waypoint_dest_sysid, mavlink_waypoint_dest_compid, waypoint_request_i);
		mavlink_flags.mavlink_request_specific_waypoint = 0;
	}

	// SEND NUMBER OF WAYPOINTS IN WAYPOINTS LIST
	if (mavlink_flags.mavlink_send_waypoint_count == 1)
	{
		int16_t number_of_waypoints = waypoint_count();

		//send_text((uint8_t *)"Sending waypoint count\r\n");
		DPRINT("Sending waypoint count: %u\r\n", number_of_waypoints);
		mavlink_msg_mission_count_send(MAVLINK_COMM_0, mavlink_waypoint_dest_sysid, mavlink_waypoint_dest_compid, number_of_waypoints);
		mavlink_flags.mavlink_send_waypoint_count = 0;
	}

	// SEND DETAILS OF A SPECIFIC WAYPOINT
	if (mavlink_flags.mavlink_send_specific_waypoint == 1)
	{
			//send_text((uint8_t *)"Time to send a specific waypoint\r\n");
			DPRINT("Time to send a specific waypoint: %u\r\n", mavlink_waypoint_requested_sequence_number);

//			mavlink_msg_mission_item_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, 
//			    uint16_t seq, uint8_t frame, uint16_t command, uint8_t current, uint8_t autocontinue, 
//			    float param1, float param2, float param3, float param4, 
//			    float x, float y, float z)

			//BUILDING

			//struct waypoint3D    { int32_t x; int32_t y; int16_t z; };

//			struct waypoint3D getWaypoint3D(uint16_t wp);
//			struct waypoint3D wp;
//			wp = getWaypoint3D(mavlink_waypoint_requested_sequence_number);
			wp = getWaypoint3D(mavlink_waypoint_requested_sequence_number);



			//float lat_float, lon_float, alt_float = 0.0;
			//uint32_t accum_long = IMUlocationy._.W1 + (lat_origin.WW / 90); //  meters North from Equator
			//lat_float  = (float)((accum_long * 90) / 10000000.0); // degrees North from Equator
			//lon_float = (float)((float) lon_origin.WW  + ((float)(IMUlocationx._.W1) * 90.0) / (float)(cos_lat / 16384.0)) / 10000000.0;
			//extern struct relWaypointDef wp_to_relative(struct waypointDef wp);
			//struct relWaypointDef current_waypoint = wp_to_relative(waypoints[waypointIndex]);
			//alt_float =  ((float)(IMUlocationz._.W1)) + (float)(alt_origin.WW / 100.0);
			mavlink_msg_mission_item_send(MAVLINK_COMM_0, mavlink_waypoint_dest_sysid, mavlink_waypoint_dest_compid, \
			    mavlink_waypoint_requested_sequence_number, mavlink_waypoint_frame, MAV_CMD_NAV_WAYPOINT, mavlink_waypoint_current, true, \
			    0.0, 0.0, 0.0, 0.0, \
			    (float)wp.y / 10000000.0, (float)wp.x / 10000000.0, wp.z);

			DPRINT("waypoint %f %f %f\r\n", (double)wp.y / 10000000.0, (double)wp.x / 10000000.0, (double)wp.z);

			mavlink_flags.mavlink_send_specific_waypoint = 0;
	}
	if (mavlink_waypoint_timeout  > 0) mavlink_waypoint_timeout--;

#endif // (FLIGHT_PLAN_TYPE == FP_WAYPOINTS)
/*
	// Acknowledge a command if flaged to do so.
	if (mavlink_send_command_ack == true)
	{
		mavlink_msg_command_ack_send(MAVLINK_COMM_0, mavlink_command_ack_command, mavlink_command_ack_result);
		mavlink_send_command_ack = false;
//.........这里部分代码省略.........
开发者ID:kd0aij,项目名称:MatrixPilot,代码行数:101,代码来源:MAVMission.c

示例11: MissionRequest

static inline void MissionRequest(mavlink_message_t* handle_msg)
{
	mavlink_mission_request_t packet;

	//send_text((uint8_t*)"waypoint request\r\n");
	//DPRINT("mission request\r\n");

	// Check if in sending waypoint mode ...
	if (!mavlink_flags.mavlink_sending_waypoints)
	{
		DPRINT("mission request not valid, no longer sending\r\n");
		return;
	}
	// decode
	mavlink_msg_mission_request_decode(handle_msg, &packet);
	if (mavlink_check_target(packet.target_system, packet.target_component)) return;
	mavlink_waypoint_timeout = MAVLINK_WAYPOINT_TIMEOUT;
	mavlink_waypoint_requested_sequence_number = packet.seq;
	DPRINT("mission request: packet.seq %u\r\n", packet.seq);
	mavlink_waypoint_frame = MAV_FRAME_GLOBAL; // reference frame
	if (mavlink_waypoint_requested_sequence_number == waypointIndex)
	{
		mavlink_waypoint_current = true;
	}
	else
	{
		mavlink_waypoint_current = false;
	}
	// send waypoint
	mavlink_flags.mavlink_send_specific_waypoint = 1;

	/************** Not converted to MAVLink wire protocol 1.0 yet *******************/
	//uint8_t action = MAV_ACTION_NAVIGATE; // action
	//uint8_t orbit_direction = 0; // clockwise(0), counter-clockwise(1)
	//float orbit = 0; // loiter radius
	//float param1 = 0, param2 = 0;

	//switch(tell_command.id)
	//{
		//case CMD_WAYPOINT: // navigate
			//action = MAV_ACTION_NAVIGATE; // action
			//break;

		// case CMD_LOITER_TIME: // loiter
			//orbit = get(PARAM_WP_RADIUS); // XXX setting loiter radius as waypoint acceptance radius
			//action = MAV_ACTION_LOITER; // action
			//param1 = get(PARAM_WP_RADIUS);
			//param2 = tell_command.p1*100; // loiter time
			//break;

		// case CMD_TAKEOFF: // takeoff
			//action = MAV_ACTION_TAKEOFF;
			//break;

		//case CMD_LAND: // land
			//action = MAV_ACTION_LAND;
			//break;

		//defaut:
			//gcs.send_text("command not handled");
			//break;
	//}

	// time that the mav should loiter in milliseconds
	//uint8_t current = 0; // 1 (true), 0 (false)
	//if (packet.seq == get(PARAM_WP_INDEX)) current = 1;
	//float yaw_dir = 0; // yaw orientation in radians, 0 = north XXX: what does this do?
	//uint8_t autocontinue = 1; // 1 (true), 0 (false)
	//float x = tell_command.lng/1.0e7; // local (x), global (longitude)
	//float y = tell_command.lat/1.0e7; // local (y), global (latitude)
	//float z = tell_command.alt/1.0e2; // local (z), global (altitude)
	// note XXX: documented x,y,z order does not match with gps raw
	//mavlink_msg_waypoint_send(chan,handle_msg->sysid,
		//handle_msg->compid,packet.seq,frame,action,
		//orbit,orbit_direction,param1,param2,current,x,y,z,yaw_dir,autocontinue);

	// update last waypoint comm stamp
	//global_data.waypoint_timelast_send = millis();
}
开发者ID:kd0aij,项目名称:MatrixPilot,代码行数:79,代码来源:MAVMission.c

示例12: MissionItem

static inline void MissionItem(mavlink_message_t* handle_msg)
{
	int16_t flags;
	struct waypoint3D wp;
	mavlink_mission_item_t packet;
	//send_text((uint8_t*)"waypoint\r\n");
//	DPRINT("mission item\r\n");

	// Check if receiving waypoint
	if (!mavlink_flags.mavlink_receiving_waypoints) return;

	// decode
	mavlink_msg_mission_item_decode(handle_msg, &packet);
	if (mavlink_check_target(packet.target_system, packet.target_component)) return;

	DPRINT("mission item: %u\r\n", packet.seq);

	// check if this is the requested waypoint
	if (packet.seq != waypoint_request_i) return;

	// store waypoint
	//uint8_t loadAction = 0; // 0 insert in list, 1 exec now

	switch (packet.frame)
	{
		case MAV_FRAME_GLOBAL:
		{
//			DPRINT("FRAME_GLOBAL\r\n");
//struct waypoint3D  { int32_t x; int32_t y; int16_t z; };
//struct waypointDef { struct waypoint3D loc; int16_t flags; struct waypoint3D viewpoint; };

//			DPRINT("packet.x %f packet.y %f packet.z %f\r\n", packet.x, packet.y, packet.z);
			//tell_command.lng = 1.0e7*packet.x;
			//tell_command.lat = 1.0e7*packet.y;
			//tell_command.alt = packet.z*1.0e2;

			// MatrixPilot uses X & Y in reverse to QGC
			wp.x = packet.y * 1.0e7;
			wp.y = packet.x * 1.0e7;
			wp.z = packet.z;
			flags = F_ABSOLUTE;
			break;
		}
		case MAV_FRAME_LOCAL_NED: // local (relative to home position)
		{
			DPRINT("FRAME_LOCAL - not implemented\r\n");
			//tell_command.lng = 1.0e7*ToDeg(packet.x/
					//(radius_of_earth*cos(ToRad(home.lat/1.0e7)))) + home.lng;
			//tell_command.lat = 1.0e7*ToDeg(packet.y/radius_of_earth) + home.lat;
			//tell_command.alt = -packet.z*1.0e2 + home.alt;
			break;
		}
	}

	// defaults
	//tell_command.id = CMD_BLANK;

// Currently F can be set to: F_NORMAL, or any combination of:
// F_ABSOLUTE       - Waypoints are Relative by default, unless F_ABSOLUTE is specified.
// 
// F_TAKEOFF        - More quickly gain altitude at takeoff.
// F_INVERTED       - Navigate to this waypoint with the plane upside down. (only if STABILIZE_INVERTED_FLIGHT is set to 1 in options.h)
// F_HOVER          - Hover the plane until reaching this waypoint. (only if STABILIZE_HOVER is set to 1 in options.h)
//                    NOTE: while hovering, no navigation is performed, and throttle is under manual control.
// F_LOITER         - After reaching this waypoint, continue navigating towards this same waypoint.  Repeat until leaving waypoint mode.
// F_TRIGGER        - Trigger an action to happen when this waypoint leg starts.  (See the Trigger Action section of the options.h file.) 
// F_ALTITUDE_GOAL  - Climb or descend to the given altitude, then continue to the next waypoint.
// F_CROSS_TRACK    - Navigate using cross-tracking.  Best used for longer waypoint legs.
// F_LAND           - Navigate towards this waypoint with the throttle off.

	switch (packet.command)
	{
		case MAV_CMD_NAV_TAKEOFF:
			DPRINT("NAV_TAKEOFF\r\n");
			//tell_command.id = CMD_TAKEOFF;
			flags |= F_TAKEOFF;
			break;
		case MAV_CMD_NAV_LAND:
			DPRINT("NAV_LAND\r\n");
			//tell_command.id = CMD_LAND;
			flags |= F_LAND;
			break;
		case MAV_CMD_NAV_WAYPOINT:
//			DPRINT("NAV_WAYPOINT\r\n");
			//tell_command.id = CMD_WAYPOINT;
			break;
		case MAV_CMD_NAV_LOITER_UNLIM:
//			DPRINT("NAV_LOITER\r\n");
			//tell_command.id = CMD_LOITER_TIME;
			//tell_command.p1 = packet.param2/1.0e2;
			break;
	}

	// save waypoint
	add_waypoint(wp, flags);
	//set_wp_with_index(tell_command, packet.seq);

	// update waypoint receiving state machine
	//global_data.waypoint_timelast_receive = millis();
	mavlink_waypoint_timeout = MAVLINK_WAYPOINT_TIMEOUT;
//.........这里部分代码省略.........
开发者ID:kd0aij,项目名称:MatrixPilot,代码行数:101,代码来源:MAVMission.c

示例13: VfatShutdown

NTSTATUS NTAPI
VfatShutdown(PDEVICE_OBJECT DeviceObject, PIRP Irp)
{
   NTSTATUS Status;
   PLIST_ENTRY ListEntry;
   PDEVICE_EXTENSION DeviceExt;
   ULONG eocMark;

   DPRINT("VfatShutdown(DeviceObject %p, Irp %p)\n",DeviceObject, Irp);

   FsRtlEnterFileSystem();

   /* FIXME: block new mount requests */

   if (DeviceObject == VfatGlobalData->DeviceObject)
   {
      Irp->IoStatus.Status = STATUS_SUCCESS;
      ExAcquireResourceExclusiveLite(&VfatGlobalData->VolumeListLock, TRUE);
      ListEntry = VfatGlobalData->VolumeListHead.Flink;
      while (ListEntry != &VfatGlobalData->VolumeListHead)
      {
         DeviceExt = CONTAINING_RECORD(ListEntry, VCB, VolumeListEntry);
         ListEntry = ListEntry->Flink;

	 ExAcquireResourceExclusiveLite(&DeviceExt->DirResource, TRUE);
         if (DeviceExt->VolumeFcb->Flags & VCB_CLEAR_DIRTY)
         {
            /* set clean shutdown bit */
            Status = GetNextCluster(DeviceExt, 1, &eocMark);
            if (NT_SUCCESS(Status))
            {
               eocMark |= DeviceExt->CleanShutBitMask;
               if (NT_SUCCESS(WriteCluster(DeviceExt, 1, eocMark)))
                  DeviceExt->VolumeFcb->Flags &= ~VCB_IS_DIRTY;
            }
         }
         Status = VfatFlushVolume(DeviceExt, DeviceExt->VolumeFcb);
         if (NT_SUCCESS(Status))
         {
            Status = VfatDiskShutDown(DeviceExt);
            if (!NT_SUCCESS(Status))
	       DPRINT1("VfatDiskShutDown failed, status = %x\n", Status);
         }
         else
         {
	    DPRINT1("VfatFlushVolume failed, status = %x\n", Status);
	 }
         ExReleaseResourceLite(&DeviceExt->DirResource);

         /* FIXME: Unmount the logical volume */

         if (!NT_SUCCESS(Status))
            Irp->IoStatus.Status = Status;
      }
      ExReleaseResourceLite(&VfatGlobalData->VolumeListLock);

      /* FIXME: Free all global acquired resources */

      Status = Irp->IoStatus.Status;
   }
   else
   {
      Irp->IoStatus.Status = STATUS_INVALID_DEVICE_REQUEST;
      Status = STATUS_INVALID_DEVICE_REQUEST;
   }

   Irp->IoStatus.Information = 0;
   IoCompleteRequest(Irp, IO_NO_INCREMENT);

   FsRtlExitFileSystem();

   return(Status);
}
开发者ID:RareHare,项目名称:reactos,代码行数:73,代码来源:shutdown.c

示例14: GGI_vgl_setmode

int GGI_vgl_setmode(ggi_visual *vis, ggi_mode *tm)
{ 
	struct vgl_priv *priv = VGL_PRIV(vis);
	ggi_graphtype gt = tm->graphtype;
	video_info_t modeinfo;
	unsigned long modenum = 0;
	char sugname[GGI_MAX_APILEN];
	char args[GGI_MAX_APILEN];
	int err = 0;
	int id, i;
	int pixelBytes;

	err = GGI_vgl_checkmode(vis, tm);
	if (err) return err;

	/* reset the modeinfo structure as expected by query_mode */
	memset(&modeinfo, 0, sizeof(modeinfo));
	
	switch(gt) {
	case GT_1BIT : modeinfo.vi_depth = 1; pixelBytes = 1; break;
	case GT_4BIT : modeinfo.vi_depth = 4; pixelBytes = 1; break;
	case GT_8BIT : modeinfo.vi_depth = 8; pixelBytes = 1; break;
	case GT_16BIT: modeinfo.vi_depth = 16; pixelBytes = 2; break;
	case GT_32BIT: modeinfo.vi_depth = 32; pixelBytes = 4; break;

	/* Unsupported mode depths */
	case GT_15BIT:
	case GT_24BIT:
	default:
		return GGI_ENOMATCH;
	}

	modeinfo.vi_width = tm->visible.x;
	modeinfo.vi_height = tm->visible.y;

	/* XXX should be added to libvgl */
	if (ioctl(0, FBIO_FINDMODE, &modeinfo))
		return -1;

	DPRINT("Setting VGLlib mode %d (0x%x)\n",
			modeinfo.vi_mode, modeinfo.vi_mode);

	/* Terminate any current mode before initialising another */
	if (priv->vgl_init_done) {
		priv->vgl_init_done = 0;
		VGLEnd();
	}

	/* XXX should be in VGL */
	if ((modeinfo.vi_mode >= M_B40x25) && (modeinfo.vi_mode <= M_VGA_M90x60))
		modenum = _IO('S', modeinfo.vi_mode);
	if ((modeinfo.vi_mode >= M_TEXT_80x25) && (modeinfo.vi_mode <= M_TEXT_132x60))
		modenum = _IO('S', modeinfo.vi_mode);
	if ((modeinfo.vi_mode >= M_VESA_CG640x400) &&
		(modeinfo.vi_mode <= M_VESA_FULL_1280))
		modenum = _IO('V', modeinfo.vi_mode - M_VESA_BASE);

	if ((err = VGLInit(modenum)) != 0) {
		DPRINT("display-vgl: setting mode 0x%x failed with error %d\n",
			modeinfo.vi_mode, err);
		return GGI_EFATAL;
	}

	priv->vgl_init_done = 1;

	if (priv->vgl_use_db) {
		_GGI_vgl_freedbs(vis);

		/* Set up DirectBuffer(s) */
		for (i = 0; i<tm->frames; i++) {
			if (LIBGGI_FB_SIZE(tm) >
				(unsigned)(VGLDisplay->Xsize*VGLDisplay->Ysize*
					pixelBytes)) {
				fprintf(stderr, "display-vgl: framebuffer too large! (%d > %d*%d*%d)\n",
					LIBGGI_FB_SIZE(tm),
					VGLDisplay->Xsize, VGLDisplay->Ysize, 
					pixelBytes);
				return GGI_ENOMEM;
			}

			_ggi_db_add_buffer(LIBGGI_APPLIST(vis), _ggi_db_get_new());

			LIBGGI_APPBUFS(vis)[i]->frame = i;
			LIBGGI_APPBUFS(vis)[i]->type = GGI_DB_NORMAL | GGI_DB_SIMPLE_PLB;
			LIBGGI_APPBUFS(vis)[i]->read = VGLDisplay->Bitmap;
			LIBGGI_APPBUFS(vis)[i]->write = VGLDisplay->Bitmap;
			LIBGGI_APPBUFS(vis)[i]->layout = blPixelLinearBuffer;
			LIBGGI_APPBUFS(vis)[i]->buffer.plb.stride
				= GT_ByPPP(tm->virt.x, tm->graphtype);
		}
	}

	/* Save mode info returned by the VESA driver */
	bcopy(&modeinfo, &priv->modeinfo, sizeof(priv->modeinfo));

	/* Palette */
	if (vis->palette) {
		free(vis->palette);
		vis->palette = NULL;
	}
//.........这里部分代码省略.........
开发者ID:Nekrofage,项目名称:DoomRPi,代码行数:101,代码来源:mode.c

示例15: PlayNote

MMRESULT
PlayNote(
    DeviceInfo* device_info,
    UCHAR note,
    UCHAR velocity)
{
    HANDLE heap = GetProcessHeap();

    NoteNode* node;

    DPRINT("PlayNote\n");

    if ( velocity == 0 )
    {
        DPRINT("Zero velocity\n");

        /* Velocity zero is effectively a "note off" */
        StopNote(device_info, note);
    }
    else
    {
        /* Start playing the note */
        NoteNode* new_node;

        EnterCriticalSection(&device_lock);

        node = device_info->note_list;

        while ( node != NULL )
        {
#ifndef ALLOW_DUPLICATE_NOTES
            if ( ( node->note == note ) && ( velocity > 0 ) )
            {
                /* The note is already playing - do nothing */
                DPRINT("Duplicate note playback request ignored\n");
                LeaveCriticalSection(&device_lock);
                return MMSYSERR_NOERROR;
            }
#endif

            node = node->next;
        }

        new_node = HeapAlloc(heap, HEAP_ZERO_MEMORY, sizeof(NoteNode));

        if ( ! new_node )
        {
            LeaveCriticalSection(&device_lock);
            return MMSYSERR_NOMEM;
        }

        new_node->note = note;
        new_node->velocity = velocity;

        /*
            Prepend to the playing notes list. If exceeding polyphony,
            remove the oldest note (which will be at the tail.)
        */

        if ( device_info->note_list )
            device_info->note_list->previous = new_node;

        new_node->next = device_info->note_list;
        new_node->previous = NULL;

        device_info->note_list = new_node;
        device_info->playing_notes_count ++;

/*
        if ( device_info->playing_notes_count > POLYPHONY )
        {
            ASSERT(tail_node);

            DPRINT("Polyphony exceeded\n");

            tail_node->previous->next = NULL;

            HeapFree(heap, 0, tail_node);

            device_info->playing_notes_count --;
        }
*/

#ifdef CONTINUOUS_NOTES
        SetEvent(device_info->work_available);
#endif

        LeaveCriticalSection(&device_lock);

        DPRINT("Note started - now playing %d notes\n", (int) device_info->playing_notes_count);
        device_info->refresh_notes = TRUE;
    }

#ifndef CONTINUOUS_NOTES
    ProcessPlayingNotes((PVOID) device_info);
#endif

    return MMSYSERR_NOERROR;
}
开发者ID:Moteesh,项目名称:reactos,代码行数:99,代码来源:beepmidi.c


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