@all
Another question, this time AHI related:
I'm trying to port something that outputs sound through AHI.
While it works, the output volume is so darn low that i can barely hear a thing (in the normal WB/AHI/Sound volume setting im using everything else is fine)
I don't know much about AHI, so if anyone could tell me how i can up the volume i'd be grateful
This is the piece of code where AHI is set up:
#define BUFFERSIZE (4 << 10)
static struct MsgPort *AHImp = NULL;
static struct AHIRequest *AHIReq[2] = { NULL, NULL };
static int active = 0;
static int8_t *AHIBuf[2] = { NULL, NULL };
#define open_audio_output open_ahi_output
static int write_ahi_output(int8_t *output_data, int output_size);
static void close_ahi_output(void);
static int open_ahi_output(void) {
AHImp = CreateMsgPort();
if (AHImp) {
AHIReq[0] = (struct AHIRequest *) CreateIORequest(AHImp, sizeof(struct AHIRequest));
if (AHIReq[0]) {
AHIReq[0]->ahir_Version = 4;
AHIReq[1] = (struct AHIRequest *) AllocVec(sizeof(struct AHIRequest), MEMF_PUBLIC);
if (AHIReq[1]) {
if (!OpenDevice(AHINAME, AHI_DEFAULT_UNIT, (struct IORequest *)AHIReq[0], 0)) {
/*AHIReq[0]->ahir_Std.io_Message.mn_Node.ln_Pri = 0;*/
AHIReq[0]->ahir_Std.io_Command = CMD_WRITE;
AHIReq[0]->ahir_Std.io_Data = NULL;
AHIReq[0]->ahir_Std.io_Offset = 0;
AHIReq[0]->ahir_Frequency = rate;
AHIReq[0]->ahir_Type = AHIST_S16S;/* 16 bit stereo */
AHIReq[0]->ahir_Volume = 0x10000;
AHIReq[0]->ahir_Position = 0x8000;
CopyMem(AHIReq[0], AHIReq[1], sizeof(struct AHIRequest));
AHIBuf[0] = (int8_t *) AllocVec(BUFFERSIZE, MEMF_PUBLIC | MEMF_CLEAR);
if (AHIBuf[0]) {
AHIBuf[1] = (int8_t *) AllocVec(BUFFERSIZE, MEMF_PUBLIC | MEMF_CLEAR);
if (AHIBuf[1]) {
send_output = write_ahi_output;
close_output = close_ahi_output;
pause_output = pause_output_nop;
resume_output = resume_output_nop;
return (0);
}
}
}
}
}
}
close_ahi_output();
fprintf(stderr, "ERROR: Unable to open AHI output\r\n");
return (-1);
}
What i've learned so far is that
AHIReq[0]->ahir_Volume = 0x10000;
sets the volume to 100%...but that doesn't help.
I assume this piece of code sends the output to a channel i haven't found how to alter the WB volume level of yet, but that's just a wild guess.
I played with the frequency and Type setting, to no avail.
There is no AHI_SetVol() in the code which i could alter.