Exemple #1
0
void moveToPause()
{
    send_audio_data(currentSong);
    send_audio_data(PLAY_PAUSE);
    currentScreen = 2;
    display_bitmap(currentScreen);
}
Exemple #2
0
static void receive_audio(void *param, struct audio_data *data)
{
	struct obs_encoder *encoder = param;

	if (!buffer_audio(encoder, data))
		return;

	while (encoder->audio_input_buffer[0].size >= encoder->framesize_bytes)
		send_audio_data(encoder);
}
Exemple #3
0
static void receive_audio(void *param, size_t mix_idx, struct audio_data *data)
{
    profile_start(receive_audio_name);

    struct obs_encoder *encoder = param;

    if (!buffer_audio(encoder, data))
        goto end;

    while (encoder->audio_input_buffer[0].size >= encoder->framesize_bytes)
        send_audio_data(encoder);

    UNUSED_PARAMETER(mix_idx);

end:
    profile_end(receive_audio_name);
}
Exemple #4
0
void calculateHeart()
{
    uint16_t x, y;
    int calc;
    int i;
    if(HeartMonitorReadValue())
    {
        if(!high)
        {
            calc = 192*60/count;
            beat[beatIndex] = calc;
            beatIndex++;
            if(beatIndex > 9)
                beatIndex = 0;
            calc = 0;
            for(i = 0;i < 10;i++)
            {
                calc += beat[i];
            }
            calc/=10;
            //display_bitmap(calc);
            sci_num(currentSong);
            sci_num(currentScreen);
            if(calc < 80 && currentSong != 0x08)
            {
                //sci_num(0x08);
                currentSong = 0x08;
                if(currentScreen == 2)
                {
                    //sci_num(0xFF);
                    //send_audio_data(STOP);
                    //audio_reset();
                    send_audio_data(currentSong);
                    //_delay_ms(100);
                    send_audio_data(PLAY_PAUSE);
                }
            }
            if(calc >= 80 && calc < 120 && currentSong != 0x09)
            {
                //sci_num(0x08);
                currentSong = 0x09;
                if(currentScreen == 2)
                {
                    //sci_num(0xFF);
                    //send_audio_data(STOP);
                    //audio_reset();
                    send_audio_data(currentSong);
                    //_delay_ms(100);
                    send_audio_data(PLAY_PAUSE);
                }
            }
            if(calc >= 120 && currentSong != 0x0A)
            {
                //sci_num(0x08);
                currentSong = 0x0A;
                if(currentScreen == 2)
                {
                    //sci_num(0xFF);
                    //send_audio_data(STOP);
                    //audio_reset();
                    send_audio_data(currentSong);
                    //_delay_ms(100);
                    send_audio_data(PLAY_PAUSE);
                }
            }
            //sci_num(calc);
            high = 1;
            count = 0;
        }
        else
            count++;
    }
    else
    {
        high = 0;
        count++;
    }
    
    if(!(PINC &(1<<PC3)))
    {
        getPoint(&x,&y);    //get the x and y point when screen is pressed
        sci_num(0xFF);
        sci_num(x);
        sci_num(y);
        switch (currentScreen) {
            case 0:   //main screen, choosing between h and p
            {
                if (x > 0x00A0) {       // right side of screen
                    moveToPause();
                }
                else{
                    moveToPause();  // left side of screen
                }
                break;
            }
            case 1:                   // music playing screen
            {
                if ((x>0x0037) & (x<0x00A3) & (y>0x003D) & (y<0x00DF)) {                 // paused button pressed, x> 120, x< 200
                    moveToPause();
                }
                else if((x>0x00A3) & (y<0x003D)){              // back button pressed, assuming bottom left is origin
                    moveToMenu();
                }
                else{                    // pressed in area that doesnt matter
                }
                
                break;
            }
            case 2:                   // music pause screen
            {
                
                if ((x>0x0037) & (x<0x00A3) & (y>0x003D) & (y<0x00DF)) {                 // play button pressed
                    moveToPlay();
                }
                else if((x>0x00A3) & (y<0x003D)){              //back button pressed
                    moveToMenu();
                }
                else
                {
                }
                break;
            }
            default:
                break;
        }
    }
}
Exemple #5
0
void moveToMenu()
{
    send_audio_data(STOP);
    currentScreen = 0;
    display_bitmap(currentScreen);
}
Exemple #6
0
void moveToPlay()
{
    send_audio_data(STOP);
    currentScreen = 1;
    display_bitmap(currentScreen);
}