問題タブ [background-music]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票する
1 に答える
242 参照

java - Java での wav の再生

それで、私はバックグラウンドミュージックでゲームをしなければならないクラスのプロジェクトに取り組んでいます. バックグラウンド ミュージックとして .wav ファイルを再生しようとしていますが、クリップを使用できない (音楽ファイルとしては短すぎる) ため、AudioStream で再生する必要があります。

私の最初の実装では、曲が終わるまでゲームがハングしていたので、それを軽減するために独自のスレッドにスローしました。現在、曲の再生中はゲームの再生が非常に遅くなります。このスレッドをアニメーター スレッドとうまく連携させるために何をする必要があるかわかりません。以下は私のバックグラウンド ミュージック プレーヤー クラスです。すべてのシステム リソースを占有する原因となった、私が間違ったことを誰か教えてください。

0 投票する
1 に答える
953 参照

javascript - IE が HTML5 バックグラウンド オーディオをサポートしていない

私のウェブサイト www.missduniya.com でバックグラウンド ミュージックを再生するための html5 オーディオ タグを追加しました。これはすべての主要なブラウザで動作しますが、IE では動作しません。

これが私のコードです

解決策を提供して助けてください:)ありがとう

0 投票する
1 に答える
639 参照

c# - MediaPlayerまたはXACTを使用せずにC#でmp3を再生する

XNAゲームでバックグラウンドミュージックを使用しようとしていますが、XNAのすべてのオプションで、オーディオファイルを.wavに変換し、プロジェクトリソースとして含める必要があります。これは2つの理由で私にはうまくいきません。まず、.wavファイルは膨大であり、ユーザーにとって実際のメリットはありません。第二に、ユーザーが自分の音楽を好む場合、ユーザーは代わりのmp3のフォルダーを持つことができません。実際にはプロジェクトの一部ではないmp3を再生するための私のオプションは何ですか?

0 投票する
4 に答える
9257 参照

ruby - mp3ファイルを再生するにはどうすればよいですか?

コマンドラインから実行したときにmp3ファイル(background-music)を再生するスクリプトをrubyで作成するにはどうすればよいですか?

私はこれを試しました

しかし、それも機能していません。上記はプレイヤー固有です。ユーザーがmplayerをインストールしていない場合はどうなりますか。もっと良い方法はありますか?

0 投票する
1 に答える
320 参照

c# - アプリの実行中にMonoTouchを使用してバックグラウンドミュージックを再生する方法

アプリの実行中にループバックグラウンドミュージックとして音楽ファイルをアプリに含める最も簡単な方法は、アプリが一時停止された場合に音楽が一時停止し、アプリがフォアグラウンドに戻ったときに再起動する方法です。デバイスのiTunes/Musicカタログで再生する必要はありません。AppBundleに含まれている1つ以上の音楽ファイルだけです。

0 投票する
3 に答える
32510 参照

javascript - 画像をクリックするとサウンドファイルを再生します

私はネイティブHTMLプログラマーではないので、この簡単な質問について飛び越えないでください。

次のコードを使用して表示している画像があります。

その画像をクリックしたときにサウンドファイルを再生したい。画像をボタンにすることはできますが、それが何らかの理由でページのレイアウトを台無しにしています。

どんなプレイヤーでも大丈夫ですが、邪魔なプレイヤーを表示したくないということだけです。ユーザーに画像を押して音楽を聴いてもらいたいだけです。彼が別の画像を押すと、現在の音楽の再生を停止し、別のサウンドを再生する必要があります。

助けてください!ありがとう!

0 投票する
1 に答える
412 参照

c# - XNAミュージックミキシングリアルタイム

音楽のセグメント(前奏曲、リピートパート、エンディングパート)とこれらのセグメントの時間情報(オフセット、スコアの長さ)を保存する「フォーマット」を作成したので、まるで1つのようにリアルタイムでミックスできます。繰り返される部分を(オプションで)無期限に繰り返しながら、音楽の一部。このようにして、前のセグメントが終了している間に、セグメントは次のセグメントが再生される場所に減衰を保存できます。(Javaでこのためのプレーヤーを作成し、Clipクラスを使用しました。)

ゲーム内で無限の長さの音楽を再生しながら、(ジュークボックス機能用に)有限の長さの音楽を提供できるように、この形式が必要でした。

しかし、この「フォーマット」を管理するクラスをXNAでコーディングしたいと思ったとき、「曲」を同時に/オーバーラップして再生する明確な方法がないことに気づきました。XNAフレームワークを離れずに、これを行うにはどうすればよいですか/ベストプラクティスは何ですか?(無限のプレイリストを作成したくありません。)

0 投票する
1 に答える
838 参照

iphone - Misunderstanding on Cocos2D: Layers, static variables and Model View Controller. Can those coexist?

sorry if the question is too dull but I have been trying to understand as much as possible from Itterheim's book book's code example and can't figure out how this works.

In my "HelloWorldLayer.m" I create an instance of a class named "MusicLayer" that extends CCLayer The inspiration of this was that in the example named "ShootEmUp" (Chapter 8 of 1) there is an InputLayer. I thus thought that I would create a MusicLayer to deal with the various music files I have in my game and got some problems (will explain at the end of the post). I got most of the music related code code from RecipeCollection02, Ch6_FadingSoundsAndMusic of the Cocos2d Cookbook .

But first I would like to introduce some of my background thoughts that might have lead to this problem with the hope to have some clear reference on this.

I am used to a "model view controller" (MVC wikipedia link) approach as I come from a C++ and Java background and never coded a game before and it does seem to me that the gaming paradigms are a bit different from "the classic" Software Engineering University approach (don't take me wrong, I am sure that in many Universities they don't teach this stuff anymore :)).

The point is that it seems to me that the "classic" Software Engineering approach is lost in those examples (for instance in the ShootEmUp code the instance of InputLayer has a reference of the class GameScene -see below- and at the same time in InputLayer there is a reference to the static shared instance of GameScene -see below-).

I was told that static instances are things to avoid. Despite this I understand the benefit of having a GameScene staic instance but I still get confused on the biderectional reference (from GameScene to InputLayer and viceversa)..:

Is this common practice in Game programming?

Is there a way to avoid this approach?

I will now paste my code and I admit it, is probably rubbish and there will be probably some obvious error as I am trying to do a very simple thing and I do not manage.

So here we are. That's the MusicLayer class (it contains commented out code as I had previously tried to make it a shared class instance):

And here we are with the .m file:

Now, I created a new Ccoos2d Helloworld template and added the following to the .m class to test the code:

But here is the error message that I get when I the simulator I try to press any button and hence trigger the play method in HelloWorld.m

The code above kind of mimics what happenes in the ShootEmUp example but I am missing something. As I cannot get the child by tag..

I asked this question as despite the answer will be probably trivial I hope to get some clarification on the general NON-ModelViewController approach in game programming and the usage of static variables.

I imagine using my MusicLayer in the MainMenu class and in the various layers implementing my levels. I would preload various music files according to the level the player is playing and keep the files that are not level specific preloaded (obviously taking care on the maximum number of sound files supported by the AudioEngine).

The other approach would have been to have a different instance of MusicLayer for each level and initializing them with different music files. The disadvantage of this approach is that the sharedAudioEngine is only one and when you want to have files keep playing between one scene and the other there is the risk of not having a full control on the track numbers used in the sharedAudioEngine (I recall should be 32 caf files for sound effect and few background tracks).

I thus understand why static instances are beneficial in game programming, but still, would love to hear what you think about the biderectional reference in 1 ShootEmUp code.

Also, would like to clarify that I encourage buying 1 as it has been a good starting point.

Thank you very much!

0 投票する
1 に答える
1550 参照

android - 画面を回転させるか、スクリーンセーバーがアクティブになると、Androidラジオアプリケーションの再生が停止します

SHOUTcastラジオ局を使用し、基本的に再生ボタンを押すと所定のインターネットラジオ局を再生するインターネットラジオアプリケーションを作成しました。正常に動作しますが、画面を回すと音楽が一時停止し、もう一度[再生]を押す必要があります。また、しばらくして画面がロックされると一時停止します。音楽が止まらないようにするにはどうすればよいですか?

ありがとう、

0 投票する
1 に答える
2302 参照

android - アクティビティを停止/終了すると音楽サービスが停止しますか?

アプリケーション (音楽プレーヤー) 用の音楽サービスを作成しました。いくつかのテストを行った後、解決方法がわからないため、頭痛の種となる動作を観察しています。

テスト目的で、サービスを変更して、サービスが開始されるとすぐに、SD カードから特定の mp3 ファイルを再生するようにしました。また、最初のアクティビティが開始され、サービスが開始されてから「finish()」が呼び出されるように、アプリケーションを変更しました。

わかりました... アプリケーションを起動すると、最初のアクティビティが開始され、サービスが起動して音楽が再生され、アクティビティが終了してアプリケーションが閉じられ、... 音楽が停止し、数秒後にサービスが再開されます (私は START_STICKY フラグを使用しているので、それは正常だと思います)。

アプリケーションを閉じたときに音楽が停止したくない、つまり、アプリケーションを閉じたときにサービスが停止されたくない (停止されたためにサービスが再開されたくない) ということです。

現在、音楽サービスを制御するために、サービスを開始してバインドし、インターフェイスで定義したサービス関数を呼び出せるようにします。

何か案は?

ありがとう!

編集:

これは、私のアプリケーションとサービスが (私が行っているテストで) 行うことの例です。

アクティビティ:

サービス: