Re: Playing Sounds June 15, 2009 06:49PM | Registered: 15 years ago Posts: 384 |
LIBS := -lpng -ljpeg -lz -lfat -lwiiuse -lbte -lfat -logc -lm -lasnd -ltremor
// Initiate audio AUDIO_Init(NULL); ASND_Init(); ASND_Pause(0);
#include "ogcsys.h" #include "asndlib.h"
Re: Playing Sounds June 15, 2009 07:57PM | Registered: 15 years ago Posts: 384 |
Re: Playing Sounds June 16, 2009 06:41AM | Registered: 15 years ago Posts: 441 |
Re: Playing Sounds June 16, 2009 11:59AM | Registered: 15 years ago Posts: 265 |
Re: Playing Sounds June 16, 2009 02:50PM | Registered: 15 years ago Posts: 384 |
Re: Playing Sounds June 17, 2009 08:33AM | Registered: 15 years ago Posts: 441 |
Re: Playing Sounds June 17, 2009 12:03PM | Registered: 15 years ago Posts: 384 |
Re: Playing Sounds June 17, 2009 03:30PM | Registered: 15 years ago Posts: 384 |
Re: Playing Sounds June 17, 2009 06:54PM | Registered: 15 years ago Posts: 441 |
Re: Playing Sounds June 17, 2009 11:55PM | Registered: 15 years ago Posts: 265 |
Re: Playing Sounds June 18, 2009 03:24PM | Registered: 15 years ago Posts: 384 |
Quote
Speaker
The Wii Remote has a small low-quality 21mm piezo-electric speaker, used for short sound effects during gameplay. The sound is streamed directly from the host, and the speaker has some adjustable parameters.
The speaker is controlled by using three output reports, together with a section of the register address space of the Wii Remote.
Report 0x14 is used to enable or disable the speaker. Setting bit 2 will enable the speaker, and clearing it will disable it. For example, to enable the speaker, send:
(52) 14 04
Report 0x19 is used to mute or unmute the speaker, and works identically to report 0x14. 0x04 will mute the speaker, and 0x00 will unmute it.
Report 0x18 is used to send speaker data. 1-20 bytes may be sent at once:
(52) 18 LL DD DD DD DD DD DD DD DD DD DD DD DD DD DD DD DD DD DD DD DD
LL specifies the data length, shifted left by three bits. The DD bytes are the speaker data. To fullfill the report length requirements, the data must be padded if it is less than 20 bytes long. Sound data must be sent at the proper rate.
Initialization Sequence
Reminder
Remember to set bit 2 (0x04) on the first byte of the Output Reports to write to registers!
The following sequence will initialize the speaker:
Enable speaker (Send 0x04 to Output Report 0x14)
Mute speaker (Send 0x04 to Output Report 0x19)
Write 0x01 to register 0xa20009
Write 0x08 to register 0xa20001
Write 7-byte configuration to registers 0xa20001-0xa20008
Write 0x01 to register 0xa20008
Unmute speaker (Send 0x00 to Output Report 0x19)
Speaker Configuration
7 bytes control the speaker settings, including volume. The full purpose of these bytes is not known, but the following values seem to produce some sound:
00 FF RR RR VV 00 00
RR RR specify the sample rate (little-endian format), using the following formulae:
pcm_sample_rate = 12000000 / rate_value adpcm_sample_rate = 6000000 / rate_value
The standard value is 0x7d0, for 3000Hz 4-bit PCM
FF configures the data format. Setting it to 0x40 configures the speaker to use signed 8-bit PCM, while setting it to 0x00 configures it to use 4-bit Yamaha ADPCM. VV specifies the volume, which has a range of 0x00-0xFF for 8-bit mode, and 0x00-0x40 for 4-bit mode.
This configuration can be used to play 4-bit ADPCM sound at 3000Hz:
00 00 D0 07 40 00 00
This configuration can be used to play 8-bit PCM sound at 1500Hz sample rate:
00 40 40 1f 40 00 00
Re: Playing Sounds June 18, 2009 03:56PM | Registered: 15 years ago Posts: 265 |
Re: Playing Sounds June 18, 2009 04:04PM | Registered: 15 years ago Posts: 384 |
Re: Playing Sounds June 18, 2009 05:46PM | Registered: 15 years ago Posts: 441 |
Quote
henke37
Wav can store that exact format btw. Or it might contain mp3 audio, it's just a container!
Re: Playing Sounds June 18, 2009 10:21PM | Registered: 15 years ago Posts: 265 |
Re: Playing Sounds June 26, 2009 06:58PM | Registered: 15 years ago Posts: 441 |
Re: Playing Sounds June 27, 2009 06:50PM | Registered: 15 years ago Posts: 384 |
Re: Playing Sounds June 29, 2009 09:02AM | Registered: 15 years ago Posts: 7 |
Re: Playing Sounds June 29, 2009 10:58AM | Registered: 15 years ago Posts: 276 |
Re: Playing Sounds June 29, 2009 12:31PM | Registered: 15 years ago Posts: 265 |