반응형

애니메이션 플레이어를 사용해 보자.

 

씬에 스프라이트를 추가하고 텍스쳐를 지정한다.

 

애니메이션 플레이어를 추가한다.

 

애니메이션 탭에서 Animation 버튼을 클릭하고 New를 선택한다.

 

애니메이션 이름(ani_1)을 지정한다.

 

Add Track - Property Track을 선택한다.

 

Sprite2D를 선택한다.

 

position을 선택한다.

 

애니메이션 탭 - position 트랙에서 마우스 오른쪽 클릭 - Insert Key 선택

 

키가 만들어지면 0초로 옮기고, 스프라이트를 이동해서 키를 하나 더 만들어 1초로 옮긴다.

 

스프라이트에 스크립트를 추가한다.

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
using Godot;
 
public partial class Control : Sprite2D
{
    public AnimationPlayer Player;
 
    public override void _Ready()
    {
        Player = GetNode<AnimationPlayer>("../AnimationPlayer");
    }
 
    public override void _Process(double delta)
    {
        if (Input.IsActionJustPressed("ui_accept"))
            Player.Play("ani_1");
    }
}
 

 

추가된 스크립트에 위와 같은 코드를 작성한다.

 

게임을 실행하고 엔터키를 누르면 애니메이션이 플레이된다.

 

※ 참고

Animation

 

반응형
Posted by J-sean
:
반응형

리눅스(우분투) 서버 같은 콘솔 환경에서도 비디오 플레이어를 사용할 수 있다.


mpv를 설치한다.


--vo=drm 옵션, 영상 파일 이름과 함께 실행한다.


자막 파일이 있다면 자막도 표시된다. 주요 단축키 목록은 아래와 같다.


  • LEFT and RIGHT: Seek backward/forward 5 seconds. Shift+arrow does a 1 second exact seek

  • UP and DOWN: Seek forward/backward 1 minute. Shift+arrow does a 5 second exact seek

  • p / SPACE: Pause (pressing again unpauses).

  • q: Stop playing and quit.

  • Q: Like q, but store the current playback position. Playing the same file later will resume at the old playback position if possible.

  • 9 and 0: Decrease/increase volume.

  • m: Mute sound.

  • o (also P): Show progression bar, elapsed time and total duration on the OSD.

  • O: Toggle OSD states between normal and playback time/duration.

  • v: Toggle subtitle visibility.

  • z and Z: Adjust subtitle delay by +/- 0.1 seconds. The x key does the same as Z currently, but use is discouraged.

  • r and R: Move subtitles up/down. The t key does the same as R currently, but use is discouraged.

  • s: Take a screenshot.

  • S: Take a screenshot, without subtitles. (Whether this works depends on VO driver support.)

  • Shift+PGUP and Shift+PGDWN: Seek backward or forward by 10 minutes. (This used to be mapped to PGUP/PGDWN without Shift.)

  • 1 and 2: Adjust contrast.

  • 3 and 4: Adjust brightness.

  • 5 and 6: Adjust gamma.

  • 7 and 8: Adjust saturation.


반응형
Posted by J-sean
:
반응형

리눅스(우분투) 서버 같은 콘솔 환경에서도 Ogg, MP3, WAV 등의 음악 파일을 재생 할 수 있다.


cmus(C* Music Player)를 설치한다.


설치가 완료되면 cmus를 실행한다.


cmus가 실행되고 아무것도 표시되지 않는다. 방향키, 엔터등을 눌러도 아무런 반응이 없지만 당황하지 말고 숫자 5를 누른다.


Browser가 표시된다. 음악 파일이 있는 디렉토리로 이동한다.



원하는 파일에서 엔터키를 누르면 플레이 된다. 하지만 선택한 1개의 파일만 플레이 되므로 간단한 사용방법을 알아 보자.


각 파일에서 a키(add to library)를 눌러 준다. (y키를 누르면 playlist로 추가된다)


숫자 1을 누른다. Library 화면이 표시되고 위에서 add한 파일이 모두 추가 되었다. 원하는 곡에서 엔터키를 눌러 플레이 할 수 있다. (Artist/Album과 Track은 Tab키로 이동한다)


숫자 2를 누르면 Sorted 화면이 표시된다.



숫자 3을 누르면 Playlist 화면이 표시된다.


숫자 4를 누르면 Queue 화면이 표시된다. Queue에 추가(e)되는 노래는 순서를 무시하고 지금 재생되는 노래 다음에 재생된다. 재생 후 queue에서 자동 삭제된다.


숫자 5를 누르면 Browser 화면이 표시된다.


숫자 6을 누르면 Filters 화면이 표시된다.



숫자 7을 누르면 Settings 화면이 표시된다. 각 단축키를 확인할 수 있다. 아래는 주요 단축키 목록이다.

  • x: play

  • v: stop

  • c: pause

  • b: next

  • z: prev

  • right: seek +5

  • left: seek -5

  • -: vol -10%

  • +/=: vol +10%

  • C(대문자): toggle continue

  • r: toggle repeat

  • s: toggle shuffle

  • t: toggle show_remaining_time

  • a: add(to library)

  • e: add(to queue)

  • y: add(to playlist)

  • delete: remove

  • q: quit


WAV 파일은 aplay로 간단히 재생할 수 있다.


반응형
Posted by J-sean
:
반응형

아래 링크의 제품과 거의 같지만 조금 더 심플한 MP3 디코더다. 


2020/11/29 - [Review] - MP3 Decoder with Built-in Amplifier Module


스위치나 터미널이 달려 있지 않아 그냥 사용하기 불편할 수 있지만 원하는 형태의 MP3 플레이어를 만들기는 더 좋다.


Micro SD카드 슬롯만 있는 작고 간단한 형태의 MP3 디코더 보드.


Pin assignment


1. V33REG DVDD33: Digital power 3.3V.

2. V50REG VMCU/BAT: Lithium battery input, 3.3V~5V.

3. VSSREG DVSS: Digital ground.

4. DACOL DACL: Left audio signal output.

5. VCOM: Center audio signal Vref, please plug 1uF capacitor voltage.

6. DACOR DACR: Right channel audio output.

7. LINEIN_R LineInR + L: LineIn left + right input.

8. IOA4: AD-key buttons.

9. IOA3 FMCLK: If IOA3 pull-down resistor to ground, IOA3 will output clock signal to the outside Hanging FM radio IC. If IOA3 is vacant, FM radio IC will take their 32768Hz crystal.

10. IOA2 Mute: Mute the external amplifier.

11. DM: USB of DM.

12. DP: USB of DP.

13. IOA0: IO-key/LED.

(1) Plug-in LED light: Output “1” represents the lit LED.

(2) IO-key1.

(3) Options are used to define the key mode.

14. IOB1 SD_CLK: Clock output T card/SD card. SD_DET: detecting whether there is an SD card is inserted, to read “0” on behalf of insertion. Please connect a 3.3KΩ resistance.

15. IOB0 SD_CMD: T card/SD card command and response. I2C_CLK: I2C the clock; the external EEPROM, and FM.

16. IOB2 SD_DAT: data input T card/SD Card/output. I2C_DAT: I2C of data; and external EEPROM FM.


3.7V 배터리나 (USB)5V 전원으로 작동 가능하며 Micro SD 카드에 듣고 싶은 음악을 담아 플레이 할 수 있다. 위 다이어그램과 같이 스위치와 4Ω 3W 스피커를 연결해 사용한다.


■ Previous/Volume--: 이전 곡 / 길게 누르면(약 2초) 소리 작게

■ Play/Stop: 플레이 / 정지

■ Next/Volume++: 다음 곡 / 길게 누르면 소리 크게


반응형
Posted by J-sean
:
반응형

A YouTubePlayer provides methods for loading, playing and controlling YouTube video playback.


Copy 'YouTubeAndroidPlayerApi.jar' to 'app/libs' and sync project with gradle files.


<AndroidManifest.xml>

1
    <uses-permission android:name="android.permission.INTERNET"/>



<activity_main.xml>

1
2
3
4
    <com.google.android.youtube.player.YouTubePlayerView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/youTubePlayerView"/>



<MainActivity.java>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
public class MainActivity extends YouTubeBaseActivity {
 
    YouTubePlayerView youTubePlayerView;
    YouTubePlayer player;
 
    private static String API_KEY = "AIyaSyDpsLddBj2ISc-NHU4sxWFh4JlcHNELir8";  // Your API Key
    private static String videoId = "Mx5GmonOiKo"// Youtube video ID from https://youtu.be/Mx5GmonOiKo
 
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
 
        initPlayer();
 
        Button button = findViewById(R.id.button);
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                loadVideo();
            }
        });
 
        Button button2 = findViewById(R.id.button2);
        button2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                playVideo();
            }
        });
    }
 
    public void initPlayer() {
        youTubePlayerView = findViewById(R.id.youTubePlayerView);
        youTubePlayerView.initialize(API_KEY, new YouTubePlayer.OnInitializedListener() {
            @Override
            public void onInitializationSuccess(YouTubePlayer.Provider provider, final YouTubePlayer youTubePlayer, boolean b) {
 
                player = youTubePlayer;
 
                youTubePlayer.setPlayerStateChangeListener(new YouTubePlayer.PlayerStateChangeListener() {
                    @Override
                    public void onLoading() {
 
                    }
 
                    @Override
                    public void onLoaded(String s) {
                        Toast.makeText(getApplicationContext(), s + " loaded", Toast.LENGTH_SHORT).show();
                    }
 
                    @Override
                    public void onAdStarted() {
 
                    }
 
                    @Override
                    public void onVideoStarted() {
 
                    }
 
                    @Override
                    public void onVideoEnded() {
 
                    }
 
                    @Override
                    public void onError(YouTubePlayer.ErrorReason errorReason) {
 
                    }
                });
            }
 
            @Override
            public void onInitializationFailure(YouTubePlayer.Provider provider, YouTubeInitializationResult youTubeInitializationResult) {
 
            }
        });
    }
 
    public void loadVideo() {
        if (player != null) {
            player.cueVideo(videoId);
            // Loads the specified video's thumbnail and prepares the player to play the video, but does not download any of the video stream
            // until play() is called.
        }
    }
 
    public void playVideo() {
        if (player != null) {
            if (player.isPlaying()) {
                player.pause();
            } else {
                player.play();
            }
        }
    }
}


Your activity needs to extend YouTubeBaseActivity.



Run the app and click the LOAD button.


It loads the video.


Play and enjoy the video.


반응형
Posted by J-sean
: