Sound effects with ASNDlib. No sound at all

Post Reply
nebiun
Posts: 89
Joined: Sat Dec 28, 2013 2:42 pm

Sound effects with ASNDlib. No sound at all

Post by nebiun » Mon Feb 03, 2020 9:10 pm

Hi, I'm try to play sounds using ASNDlib, but non sounds is played and non errors from ASND_Set... functions.
I attach source file and audio file (PCM 8bit mono 11025Hz).

Here the main loop:

Code: Select all

	if(ASND_SetInfiniteVoice(0, VOICE_MONO_8BIT, 11025, 0, (void *)sounds[0], sound_size[0], MAX_VOLUME, MAX_VOLUME) != SND_OK)
		printf("ASND_SetInfiniteVoice error\n");
	while(1) {

		// Call WPAD_ScanPads each loop, this reads the latest controller states
		WPAD_ScanPads();
		
		// WPAD_ButtonsDown tells us which buttons were pressed in this loop
		// this is a "one shot" state which will not fire again until the button has been released
		u32 pressed = WPAD_ButtonsDown(0);

		if (pressed & WPAD_BUTTON_A) {
			printf("Bing %d\n", hit_raw_size);
			if(ASND_SetVoice(1, VOICE_MONO_8BIT, 11025, 0, (void *)sounds[1], sound_size[1],  MAX_VOLUME, MAX_VOLUME, NULL) != SND_OK)
				printf("ASND_SetVoice error\n");	
		}
		// We return to the launcher application via exit
		else if ( pressed & WPAD_BUTTON_HOME ) break;

		// Wait for the next frame
		VIDEO_WaitVSync();
	}
	ASND_StopVoice(0);
	ASND_StopVoice(1);
Where I wrong?
Thanks guys.
Attachments
rawplayer.zip
Source, make and audio files
(70.14 KiB) Downloaded 314 times

nebiun
Posts: 89
Joined: Sat Dec 28, 2013 2:42 pm

Re: Sound effects with ASNDlib. No sound at all

Post by nebiun » Wed Feb 05, 2020 3:10 pm

Well, solved by myself.
I need use ASND_Pause(0) to unpause the sound engine, because ASND_Init leave it paused.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests